- Home /
a one time script
im working on a sidescroller with a trigger that activates once.
the script worked in all my other games that used it, but it doesnt on this one. once i touch it, the script goes as planned, but it only works when box collider is set on, and trigger set off.
so i just bump into an invisible cube, and it obstructs the way. the script works, but i want to try to have the trigger remove itself once activated.
whats the command for this? :Java:
Answer by BobbleHead · May 04, 2013 at 07:05 PM
Checking the docs, you'll see that
Destroy(gameObject);
Would destroy the gameObject and the scripts attached to it.
Sorry Edit, if you're just wanting to turn of the collider then you can access the otherObject, or your own object (depends how you're doing it) and
collider.enabled = false;
Hope that helps!
$$anonymous$$ark answer as correct if the solution works :)
Your answer
Follow this Question
Related Questions
Execute code for a certain amount of time 1 Answer
Digital Clock: Time.time > 60 2 Answers
Trying to change a range within a shader over time, using a script. 1 Answer
Convert Timer to HH:MM:SS 1 Answer
New Game & Quit Game in 1 script 1 Answer