What's wrong with my trigger set-up?
I'm trying to figure out how to set up a trigger. Nothing I've done or tried has worked. I'm sure it's something very simple, but for the life of me I can't figure it out.
In this example, I have an FPS controller and a cube. When the controller passes through the cube, I want to be able to use onTriggerEnter() or stay or exit.
Answer by voncarp · Oct 09, 2016 at 01:50 AM
Capitalize.
void OnTriggerEnter(Collider other) {
print ("HI");
}
void onTriggerEnter() {
}
should be
void OnTriggerEnter(Collider other) {
}
The o needs to be capitalized. Everything needs to be exact.
https://docs.unity3d.com/ScriptReference/$$anonymous$$onoBehaviour.OnTriggerEnter.html
Answer by CodexofRome · Oct 09, 2016 at 02:54 AM
Of course... I didn't think of that at all... it accepted the lowercase thinking I was creating something new. I'm so used to Visual Studio telling me to fix things.... blerg!
And thanks for the help!
Your answer
![](https://koobas.hobune.stream/wayback/20220612094248im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Enemy Trigger Colliders are triggering my player's trigger collider. Why? 1 Answer
Player is in range of an Item or Door and can Interact? 2 Answers
Pipe Game ... I have to trace water from source to destination 2 Answers
Collision detection without convex 2 Answers
Can not get onTriggerEnter and onCollisionEnter to work!? 2 Answers