// parent gameObject script
function OnTriggerEnter(hit: Collider)
{
if (hit.gameObject.tag == “Player”)
{
//enable/disable child game gameObject here
}
}
Is this possible?
// parent gameObject script
function OnTriggerEnter(hit: Collider)
{
if (hit.gameObject.tag == “Player”)
{
//enable/disable child game gameObject here
}
}
Is this possible?
GameObject[] childs;
void OnTriggerEnter(Collider hit)
{
foreach(GameObject child in childs) //Loop trough childs unity array
{
child.SetActive(false); //set each child to disabled
}
}
Thank you so much…while I had to change it somewhat it definitely put me on the right track. Here’s my script in java in case anyone else wants to see it.
var childs : GameObject; //object to turn on/off
function OnTriggerEnter(hit: Collider)
{
if (hit.gameObject.tag == “Player”)
{
childs.SetActive(true); //set object childs on
}
}