# \[Delete\]

**URL:** https://discussions.unity.com/t/delete/680490
**Category:** Scripting
**Tags:** Scripting
**Created:** [October 21, 2017, 11:07am UTC](https://discussions.unity.com/t/delete/680490 "2017-10-21T11:07:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![nbg\_yalta](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/nbg_yalta/32/914840_2.png) [@nbg\_yalta](https://discussions.unity.com/u/nbg_yalta)
#### Post date: [October 21, 2017, 11:07am UTC](https://discussions.unity.com/t/delete/680490/1 "2017-10-21T11:07:37Z")

</div>

I’ve a Text variable assigned in inspector, but it gives me a null reference exception, why???

[![](https://europe1.discourse-cdn.com/unity/original/4X/5/9/a/59a0dce82d414d111077f352dd716d292ebc2e5b.jpeg "strange behaviour") ](https://www.youtube.com/watch?v=52A4gfmaKgc)

---

<div class="post-metadata">

### Author: ![Suddoha](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/suddoha/32/110358_2.png) [@Suddoha](https://discussions.unity.com/u/Suddoha)
#### Post date: [October 21, 2017, 11:24am UTC](https://discussions.unity.com/t/delete/680490/2 "2017-10-21T11:24:36Z")

</div>

You defintely have 2 instances in your scene.

That would not only be my first guess, but the output indicates that as well. It prints the minus once and throws, the second instance is the one you showed in the inspector.

Do one of the following:

1. Debug.Log(gameObject.name) in that script
2. Use the scene hierarchy’s search field and type “t:GameManager”. It’ll highlight all the objects that have such script attached to it.

---

<div class="post-metadata">

### Author: ![nbg\_yalta](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/nbg_yalta/32/914840_2.png) [@nbg\_yalta](https://discussions.unity.com/u/nbg_yalta)
#### Post date: [October 21, 2017, 11:42am UTC](https://discussions.unity.com/t/delete/680490/3 "2017-10-21T11:42:44Z")

</div>

> [@Suddoha](#):
>
> You defintely have 2 instances in your scene.
> 
> That would not only be my first guess, but the output indicates that as well. It prints the minus once and throws, the second instance is the one you showed in the inspector.
> 
> Do one of the following:
> 
> 1. Debug.Log(gameObject.name) in that script
> 2. Use the scene hierarchy’s search field and type “t:GameManager”. It’ll highlight all the objects that have such script attached to it.

oh you managed to answer, yes that’s the case, realized this is possible just after making this post 😄

---

<div class="post-metadata">

### Author: ![Suddoha](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/suddoha/32/110358_2.png) [@Suddoha](https://discussions.unity.com/u/Suddoha)
#### Post date: [October 21, 2017, 11:45am UTC](https://discussions.unity.com/t/delete/680490/4 "2017-10-21T11:45:34Z")

</div>

> [@nbg\_yalta](#):
>
> oh you managed to answer, yes that’s the case, realized this is possible just after making this post 😄

Kind of - almost. When I hit the post reply button, you had already figured it out. 😛
