[Tutorial] UI Buttons with Behavior script
Hello everyone,
I have noticed that many people doesn't know about behavior script and how to use them. In this tutorial I will show you how to use UI Buttons with Behavior script to hide some elements or do whatever you want.
Import Scripts
First of all we need to import UI script, you can download it from here.
Create buttons
I have created 3 buttons, each one of them must show different post effect settings.
Edit the scripts
now we need to go to each button and add a custom behavior script to them. As in the bellow picture.
change value of "PUT CUSTOM NAME HERE" to your own unique name.
so for me i have put the script name "faded"
Now we need to create an Empty object and add under this empty object a behavior script.
inside the faded script we load the behavior script for as many as we need to change things with single click.
as you can see you need to change "Trigger" to custom trigger name,
and the trigger name is the script name you put in the UI Button callback
so then you can change the response type to do what ever you want for example I want to enable the Color Correction Faded. and I want to disable the other color corrections, so in the same script i will add another behavior script with the same trigger name to disable other objects.
now when clicking on that button it will enable one object and disable the others.
this was a short tutorial I hope it was easy.
Kind regards,
Mayed Abdulla
That was very helpful !! thanks a lot Mayed
keep it up :D
Thank you so much!
hey can you send project of this plz because im not understanding this process help
thankyou
Thank you so much ! I tried to do that during all day 😅