- Home /
Trigger activation?
Hello, im new to coding i want to get a trigger activated by collectiong a few things (e.g. you can move to the next level by collecting a key).
How can i do that?
Start by attempting to code it, came back with concrete questions with script and get help. WIN?
Answer by Theacesofspades · Mar 06, 2013 at 05:25 PM
So first on your "key" object you need to check the square that says isTrigger in the inspector. Then either your player or the "key" needs a rigidbody. Then in the code connected to the player use this:
function OnTriggerEnter ()
{
//do whatever you want here
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613093934im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
C# Make two objects collide to activate a third object 3 Answers
How to enter trigger a certain amount of times before executing code? 1 Answer
Shuttle Runs & Counter 0 Answers
problem activating an object 0 Answers
activate script using trigger 3 Answers