Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

fernandomema

Simple trigger script

Recommended Posts

There is a little script that allow's you to create custom actions on trigger enter and exit without coding, like a button:

Please login or register to see this code.

Simply create a cube and check "Is Trigger", and add the previous script to the gameObject.

 

you shuld see something like this:

image.png.3f7c60797b132809cad3201b803cb5c8.png

Edited by fernandomema
Changed uncheck "is trigger" to check "is trigger"
  • Like 2

Share this post


Link to post
Share on other sites

How did it work for you if you have "Is Trigger" disabled? 😅

Anyways, I've extended it to work with layers. This way you only need one enter/exit event.

Please login or register to see this code.

Please login or register to see this link.

Edited by UnityGamesRoland
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...