- Home /
Animation/Scripting
I’m really new to Unity and I’m not exactly sure how to script this. But I have a book game object and fire/plant/water magic and I want it click on the book and it’ll change the magic within each click. I have all the animations done in the animation properties tag I need to figure out how to click and change the magic from fire and then another click to water and click again to plant.
Thanks!
Answer by lullaby_ · Oct 03, 2020 at 05:30 PM
Go to animator . Create and connect animation states to each other respectively. Create a trigger paramater for transitions. Now go to button that you use for clicking on the book. From the inspector open an on click event. Assign the animator to on click event. From the no function list, > choose = Animator > SetTrigger(string). And write your trigger paramater here. Now whenever you click the button new animation will work.