- Home /
Question by
javim93 · Jul 11, 2014 at 09:05 PM ·
prefabgetcomponenttag
Acces object in scene, not prefab
Hi, im using this variable that is inside an object:
" var Script = GameObject.FindWithTag("Player");
Script.GetComponent(playerhambre2beta).hambre -= cantidad; "
It acces an script that the player have. It works great when objects are in scene, there is no problem to find the player. But when I instantiate this objects, they look to the player prefab and not the player in scene. I dont know if its a bug or im missing something. Sorry about my english!
Comment
Best Answer
Answer by javim93 · Jul 12, 2014 at 04:12 AM
nevermind, the problem was on the var script, i removed it and used just the entire function gameobjectfind...... Thanks!