Linked Questions
48 questions linked to/from NullReferenceException in Unity
0
votes
2
answers
8k
views
Add image to button in unity [duplicate]
Sorry if this question has already an answer somewhere, but I've just started to play with Unity and now I'm stuck. :(
I've tried a few things ( from here , here and here and others ) but none of ...
0
votes
1
answer
5k
views
How can I get the Text component from TextMeshPro ? I'm getting null exception [duplicate]
At the top of the screen :
public GameObject uiSceneText;
private TextMeshPro textMeshPro;
Then in the script at some point :
...
-1
votes
1
answer
784
views
The game is running but it gives me Object reference not set to an instance of an object error on console [duplicate]
When I play the game it works perfectly fine but it shows an error in the console when pressing buttons but it is still working just causing a bit of lag.
This is the error:
NullReferenceException: ...
-1
votes
1
answer
563
views
Null reference on gameObject that has been successfully referenced [duplicate]
It's exactly as the title says. I am getting a null reference error even though I have properly referenced the object. I have debugged my code to show that the result is always exactly what I need ...
1
vote
1
answer
459
views
-1
votes
1
answer
551
views
-1
votes
1
answer
226
views
NullReferenceExepction Error [duplicate]
I'm getting error an error on this piece of code:
if (EventSystem.current.IsPointerOverGameObject())
return;
The error:
...
0
votes
2
answers
243
views
NullReferenceException in my inventory system [duplicate]
I'm making a simplified inventory system for a 3d game.
When I try to pick up an object, I get the following error:
NullReferenceException: Object reference not set to an instance of an object
Here ...
0
votes
1
answer
188
views
NULL REFERENCE EXCEPTION Object reference not set to an instance of an object [duplicate]
So I have 3 scripts:
first for my player movementscript
second for my speed powerup speedscript
third for my obstacle ...
0
votes
1
answer
145
views
NullReferenceException Error For Respawning [duplicate]
I am making an infinite runner game, and I am having issues with killing and respawning the player. I have a coroutine setup on the GameMaster objec which is the respawn and on the player I have a ...
1
vote
1
answer
130
views
swipe control can't destroy gameobject [duplicate]
I tried to make a game where you can destroy something when you swipe or tap. However, it says NullReferenceException & while the swipe control actually works, ...
-1
votes
1
answer
85
views
NullReferenceException when translating instantiated prefab [duplicate]
I keep getting this error:
NullReferenceException: Object reference not set to an instance of an object
moveBlock.Update () (at Assets/Scripts/moveBlock.cs:27)
whenever I press Play in Game or when ...
0
votes
1
answer
89
views
nullException issue [duplicate]
I have a problem when I was trying to change a state within my character. I wrote the code below
...
0
votes
1
answer
74
views
Unity game crashing when dialogue with NPC initiated [duplicate]
I have 3 NPCs in my "Game". When the player walks up to any of them, they're supposed to have their own dialogue; I've tested this, and they do.
I tried to create a display that shows this dialogue ...
0
votes
0
answers
74
views
Issue with button clicked by mouse? [duplicate]
I have panel with some images and buttons. when I click on a button with "gold" name it works, and if I click on any thing other I got error //NullReferenceException: Object reference not set to an ...
-3
votes
1
answer
82
views
how to call function [duplicate]
how do I get a function from another script and insert it into a button, I did this is giving this error
"Object reference not set to an instance of an object"
...
0
votes
1
answer
59
views
Rewriting a text object [duplicate]
I'm trying to set up a UI system. Say I have a text object 'text' which is visible onscreen. I want to change it with a button press using a script such that the text box's previous string is replaced ...
0
votes
1
answer
52
views
NullReferenceException. Why? [duplicate]
I have a line:
private void OnTriggerEnter2D(Collider2D collider)
{
checkID = collider.GetComponent<PartInfo>().ID;
}
That PartInfo.cs:
...
0
votes
1
answer
39
views
I keep getting this error when I run my game so far [duplicate]
I have a tags script:
...
0
votes
0
answers
30
views
Adding Score to score canvas after collision [duplicate]
Simply a player has to move through pipes falling down, once the player moves through the gap it should add a score and increase the scoring after each pipe the player goes through, pretty basic.
I ...
0
votes
0
answers
30
views
How to fix this NullReferenceException error? [duplicate]
I am trying to fix an error that says "Object reference not set to an instance of an object". The purpose of this script is to spawn a prefab that follows the mouse when you click a UI ...
0
votes
0
answers
26
views
NullReferenceException: Object reference not set to an instance of an object PlatformController.FixedUpdate () [duplicate]
How do I fix it, I don't know how I fix it? Can anyone help me?
...
0
votes
0
answers
25
views
game object disappears when I add OnTriggerEnter script [duplicate]
I'm setting up collision detection for my enemy objects and projectile. When I add the detect collision script below, my enemy object just disappears. Projectile has the same detect collision script ...
0
votes
0
answers
23
views
NullReferenceException: Object reference not set to an instance of an object on boolean variable from separate class [duplicate]
I'm trying to develop game scenario that able to trigger the alarm with alarm light and siren audio to play. For the testing purpose I set it that to boolean value as "alarmOn" in AlarmLight class.
<...
0
votes
0
answers
22
views
object reference not set to an instance of an object [duplicate]
hello i have a error "object reference not set to an instance of an object"
when my ball collide with the spikes.its supose to remove one heart but it doesnt.
health code:
...
0
votes
0
answers
24
views
Null Reference Exception in Switch Case [duplicate]
I'm getting an annoying NullReferenceException error. Can anyone help? This is the function, and below you can see how it is called:
Error message:
NullReferenceException: Object reference not set to ...
0
votes
0
answers
21
views
Set DisplayName in textfield problems Object reference not set to an instance of an object [duplicate]
Folks. I'm trying to set the DisplayName default value directly from the API, the debug log correctly informs the username. But when I believe that it should fill ...
0
votes
0
answers
21
views
NullReferenceException: Object Reference Not Set to an Instance of an Object (How is that so and I should I solve it?) [duplicate]
I am stuck several days because of this problem, which I am almost on the verge of giving up. (Using Unity Engine 2019.3a by the way). The TextButtonName.text can't read what TextButton is throwing to ...
0
votes
1
answer
32
views
0
votes
0
answers
20
views
NullReferenceException until tile is spawned [duplicate]
I have a tile and tile has enemies spawn positions, and spawner script in it. Everything works fine when tile is spawned, my ray hits the collider in tile and enemies get spawned, but my spawn script ...