0
Well I made a script where activate and disable in a gameobject
, I wanted to know how to activate and deactivate children also within this script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class OBJETOS : MonoBehaviour
{
public GameObject[] arrayObjetos;
public void botoes(int num)
{
for(int i = 0; i < arrayObjetos.Length; i++)
{
if( arrayObjetos[num] == arrayObjetos[i])
{
arrayObjetos[i].SetActive(true);
}else{
arrayObjetos[i].SetActive(false);
}
}
}
}
//sei que pode ser assim GameObject meuobjeto = GameObject.Find("meuobjeto");
// e assim tbm GameObject ChildGameObjeto1 = ParentGameObject.transform.GetChild (0).gameObject;
yes, more in the script where I did above, where I put it?
– Nitecki
Basses? arrayObjects[i]. Setactive(true); }Else{ arrayObjects[i]. Setactive(false);
– Nitecki
i did not tendi very well your question. From what I understand, you need to disable all fillhos of the object you put the script to. If that’s it, you can put it on
void start()
that when the game starts, this object will be disabled. But if that’s not it, please explain your question better– isaque
Ah ta, you want to deactivate the children of the object that will be deactivated?
– isaque
I managed to add the forech and Gg vlw
– Nitecki