Linked Questions

0
votes
2answers
3k 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 ...
1
vote
1answer
260 views
-1
votes
1answer
238 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: ...
0
votes
2answers
143 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 ...
-1
votes
1answer
47 views

NullReferenceExepction Error [duplicate]

I'm getting error an error on this piece of code: if (EventSystem.current.IsPointerOverGameObject()) return; The error: ...
0
votes
1answer
40 views

nullException issue [duplicate]

I have a problem when I was trying to change a state within my character. I wrote the code below ...
1
vote
1answer
64 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, ...
0
votes
1answer
60 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 ...
0
votes
1answer
37 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 ...
-3
votes
1answer
46 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" ...
-1
votes
1answer
33 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 ...
0
votes
1answer
34 views

I keep getting this error when I run my game so far [duplicate]

I have a tags script: ...
0
votes
0answers
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
0answers
25 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 ...
0
votes
0answers
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
0answers
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
0answers
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 ...
0
votes
1answer
20 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
1answer
19 views
0
votes
0answers
19 views

Does anyone know what caused this? [duplicate]

My code was working until the program crashed, then it started showing this. I actually don't know what caused this, but it was working before the crash... I have recently started programming so I don'...
0
votes
0answers
18 views

Error modify bools from script1 iin script2 then get bools value frrom script2! [duplicate]

I have a GameObject called "emptyobject" with a FullOrFree component attached, containing several public boolean variables: ...
0
votes
0answers
17 views

Unity Giving following error : NullReferenceException: Object reference not set to an instance of an object [duplicate]

im going to probably look really stupid and i will be no means admit this is my code however i cant seems to get it to work so i was wondering you you might be able to? I'm getting the following ...
0
votes
0answers
17 views

Coroutine not working, NullReferenceException Unity [duplicate]

When I run my game and collide with my object, I get a NullreferenceException error. I went through many posts I could find on Stackexchange and other websites, but nothing helped. When I did a Debug....
0
votes
0answers
16 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
0answers
14 views

NullReferenceException: Object reference not set to an instance of an object [duplicate]

Hi so im displaying food, health an water on the screen in a text box by using UnityEngine.UI and making text variables. They are all defined in the update function so they will keep changing and are ...
0
votes
0answers
11 views

Can't enable script component on a prefab instance in Unity [duplicate]

Prefab structure: MainObject (parent; prefab instance in the scene) |-Child |-Child |-Triggers |-Trigger1 MainObject has: ScriptIWantToEnable (Script) ...
0
votes
0answers
8 views

Object reference not set to an instance of an object error? (Unity) [duplicate]

I am creating a simple 2d game in Unity. I tried to make the player able to pick up objects whenever they are clicked, but I keep getting the error I mentioned. Here are the scripts I used : (Both of ...
0
votes
0answers
6 views

getting data from an array stored in a different script Unity [duplicate]

LandingScript w = GetComponent<LandingScript>(); foreach (Transform x in w.Waypoints) { allWaypoints[i] = x; i += 1; } i want ...
1
vote
1answer
560 views

Trying to draw lines using LineRenderer from tower to spawners

So I have a tower surrounded by 4 spawner gameobjects. I want to draw lines to all of them using LineRenderer. I wrote the following code to achieve this but for ...
-1
votes
1answer
501 views

(Unity / Android) Get Component Text UI not found. (Error: Object reference not set to an instance of an object) [closed]

I have a scene Scene001.and a few UI objects which is Canvas and its child object Text. I have another scripted EmptyObject. .Canvas (Tag: "canvas01") ...Text (Tag: "textTag") .EmtpyObject (...
2
votes
1answer
111 views

Cannot assign values to variables (?)

I wouldn't say i'm new to unity or programming in general.. but right now i feel so stupid. I have a simple enemy script. I instantiate object with another script, calling SettingUpCreep and giving ...
0
votes
1answer
216 views

AudioSource NullReferenceException: Object reference not set to an instance of an object

I honestly don't understand what's going on. This was working perfectly fine yesterday. I have a GameObject in my scene that has an AudioSource attached. The AudioSource has a dragged in .wav file in ...
0
votes
0answers
77 views

Why do I get a “Value Cannot be Null” error on material.SetTexture?

Probably a really noob question, but: I'm following this tutorial here and, using the code in the tutorial, I'm getting an annoying error: Here's the code in question, the error is referring to line ...
0
votes
1answer
47 views

Unity Initializing class of a script not working

I have been trying to find a solution for the last couple of hours so please hear me out. At first I got a NullReferenceException, which I resolved(?) by initializing the class first (This is my ...
0
votes
1answer
15 views

nullObjectException in OnDrawGizmos Function

I was studding A* Algorithm and it is showing a nullObjectException in my OnDrawGizmos function whenever it finishes compiling the code. Here is my code - can ...