Identify what is null ← any other action taken before this step is WASTED TIME
Identify why it is null
Fix that.
Expect to see this error a LOT. It’s easily the most common thing to do when working. Learn how to fix it rapidly. It’s easy. See the above link for more tips.
You need to figure out HOW that variable is supposed to get its initial value. There are many ways in Unity. In order of likelihood, it might be ONE of the following:
drag it in using the inspector
code inside this script initializes it
some OTHER external code initializes it
? something else?
This is the kind of mindset and thinking process you need to bring to this problem:
Step by step, break it down, find the problem.
Here is an analogy of a null reference:
I give you an empty cookie jar
I tell you to take a cookie from the jar
Your job is to identify which jar is empty, find out why it is empty, and fix that.
I believe your are calling “StartD” before the “Start” method of your script, causing to find sentences equal to null.
What you are doing in start (the initialization of the Queue) can be done also right when declaring the attribute at line 16; or you can do it in Awake. This way, StartD will call “sentences.Clear()” on an empty (but initialized) Queue.
Hey thanks for quick response , i am currently not home but i will put the full log plus the full description when i get back
I forgot to put it in orginal description
Hi, thanks for quick reaponse I am calling it at the same time as start ( in another start function ) i will test calling it in a courotin and see will it work
Even if you don’t end up using either of those, you could review them for structure because it is almost certain that they have already solved all the same problems you are trying to solve.