I’m trying to disable and activate a child gameObject based on the parents condition. So far i can disable the object but i cant re-enable it. I just get the NullRefrenceException. Does Unity no longer reconize a gameObject that has been disabled at runtime?
function ShieldUpDown(){
if (ShieldsEnabled == true){
if (ShieldsUp == false){
if (Shields > 0){
ShieldsUp = true;
transform.Find("/Fighter/Shield").gameObject.active = true;
}
}
else
if (Shields <=0){
if (ShieldsUp == true){
ShieldsUp = false;
transform.Find("/Fighter/Shield").gameObject.active = false;
}
}
}
else
ShieldsUp = false;
The end result I’m really just trying to deactivate the collider component.