0

Code Console

this is the problem when i use OnTriggerEnter and call the function there.

D.B
  • 588
  • 3
  • 17
  • i know the nullreferenceException, but i cant find how to fix this code – pheewhy Oct 12 '20 at 04:23
  • i think i didn't instance but i don't know how to do.. – pheewhy Oct 12 '20 at 04:25
  • What is the line where the error pop ? You didn't gave us the code with line number. Are you sure a `GameObject` named "GameManager" exist and contain the `GameManager` script. And current GameObject has a `ThisCard` script on it ? – D.B Oct 12 '20 at 09:21
  • **NEVER use nullpropagation (`.?`) on any type derived from `UnityEngine.Object`!** See e.g. [this question](https://stackoverflow.com/questions/58487442/why-does-resharper-not-suggest-using-null-propagation-for-both-of-these-blocks) and in particular [this Unity blog post](https://blogs.unity3d.com/2014/05/16/custom-operator-should-we-keep-it/) ... always use the [`bool` operator](https://docs.unity3d.com/ScriptReference/Object-operator_Object.html) instead! And in general for this community: **Don't post images of code!** – derHugo Oct 12 '20 at 09:36

0 Answers0