- Home /
Need help with setting all items of a specific tag to "inactive" when i die.
I am making a platform level and my death trigger looks like this. the level is based around hitting switches to activate the next platform. but when i die, i want the platforms to go back to how they were when the level started, inactive.
var spawn : Transform;
var platforms : GameObject[];
platforms = GameObject.FindGameObjectsWithTag("platforms");
function OnTriggerEnter(other : Collider)
{
if (other.tag == "Player")
{
other.transform.position = spawn.position;
audio.Play();
platforms.SetActive(false);
}
}
I want the game objects with the tag "platforms" to be set to inactive when i cross the death trigger, effectively starting the level over.
but right now, nothing is happening, im respawning, but the platforms are still active.
Answer by codecranker · Apr 17, 2013 at 03:43 AM
platforms is an array of GameObjects. Are you sure you can do platforms.SetActive(false); without iterating over each item inside an array?
Your answer
Follow this Question
Related Questions
Need help with setting all items of a specific tag to "inactive" when i die. 0 Answers
My array does not update when object is destroyed. How do I fix it? (java) 2 Answers
Never repeat last random audioclip 2 Answers
Having Multiple Controllable FPS Units Selected From A Singular RTS Mode? 0 Answers
Trying to make simple trigger score counter, having troubles. 0 Answers