- Home /
Question by
TheSorm · May 04, 2016 at 09:12 PM ·
c#errorfindwithtagfindgameobjectwithtag
Save Script and use it causes Errors
chosenBombType = GameObject.FindWithTag("Player").GetComponent<FirstPersonController>().GetBombType();
hScript = GameObject.FindGameObjectWithTag("Player").GetComponent<Health_Script>();
somethimes i get errors with this 2 lines of code. Sometimes its works and than when i chance something in the scripts nothing todo with this lines it get an error. I dont understand why i cant save the script of an gameobject and use it after that?
Comment
one of these function is in awake one is in start so thats make no difference, NullReferenceException: Object reference not set to an instance of an object UpdateDamageOverlay.Awake () (at Assets/UpdateDamageOverlay.cs:16)
and yes the Tag is right to i checkt that...
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Help with GameObject.FindGameObjectsWithTag 1 Answer
Find, Findwithtag, findgameobjectwithtag Not working 3 Answers
Multiple Cars not working 1 Answer
Sync with visual studio 2010 error 1 Answer