Hi everyone, I’m a fairly new Unity user, and I recently started writing my own scripts, and I have a trigger-collision problem. Simply enough, I want to write a script to make a mesh interact with a trigger, and I know how to do it by attaching the script to the trigger:roll_eyes:, but I need to attach the script to the mesh instead.:(.
I tried to use the "void OnTriggerEnter function, but it apparently only refers to triggers within the game object the script is attached to. Is there a way to reference an external trigger in a similar function?
OnTriggerEnter triggers on both the trigger, and the regular rigidbody contacting the trigger. I think your problem is your parameter: you’re using Collision (which is only sent when two non-triggers collide, via OnCollisionEnter). OnTriggerEnter takes a Collider instead. If the parameter is wrong, Unity won’t find the function, just as if you’d misspelled it.