- Home /
Setting enabled on my objects children doesn't work
I am trying to enable a child's script named "ExplodeOnImpact" in my OnTriggerEnter function, but it doesn't seem to set the actual enabled flag permanently. It almost seems that my script variable is local only.
for (var child : Transform in transform) { var script : ExplodeOnImpact = child.GetComponent(ExplodeOnImpact);
if (script != null)
{
script.enabled = true;
}
}
It finds the scripts and tells me that it set it correctly, but I have logged the actual value within the ExplodeOnImpact script and it never changes...
If it makes any difference, I am using Unity Pro iPhone 1.7.0
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
'enabled' is not a member of UnityEngine.Component 2 Answers
AddComponent() causes a "trying to create a MonoBehaviour using the 'new' keyword" warning 2 Answers
Disabling GameObject doesn't disable components 0 Answers
Reseting Component/GameObject to its initial scene state. 4 Answers