- Home /
Question by
jamesonSouza · Jun 02, 2018 at 12:07 AM ·
getcomponentprefab-instance
How find Object after Instantiate in scene
Hey guys.
How fin game object after Instantiate in scene .
He start disabled and I use event button for active after 5seg disable. More after last disable dont find more.
void Awake()
{
if (_escudo != null)
{
_escudo = GameObject.Find("Escudo");
}
else
{
}
}
this courotine
IEnumerator EscudoForca()
{
_escudo.SetActive (true);
// _escudo.SetActive(true);
_uiEscudo.SetActive(true);
statusBar.fillAmount = 1;
anim.SetBool("ativado", true);
_timeDelay = 5.0f;
// _escudo = GameObject.Find("Escudo");
yield return new WaitForSeconds(_tempoDuracaoPoderes);
_escudo = GameObject.Find("Escudo");
// GetAllObjectsInScene();
_escudo.SetActive(ativado);
//_escudo.SetActive(false);
_uiEscudo.SetActive(false);
statusBar.fillAmount = 0;
anim.SetBool("ativado", false);
I try much, more nothing
Comment
Answer by b1gry4n · Jun 02, 2018 at 12:14 AM
You arent instantiating anything in your script. if you were instantiating... getting the reference is very simple
GameObject newObject = (GameObject)Instantiate(yourPrefab);
Your answer
Follow this Question
Related Questions
Delete a specific instantiated prefab by its vector3 coordinates? 0 Answers
How do I get the Player's Health Script as Component? 1 Answer
My question is how to give a newly made prefab a location target. 2 Answers
Collection Using "GetComponent" 1 Answer
Transfering variable between gameojects and scripts 2 Answers