Reputation: 349
I used NGUI (free edition) in unity 4.x for GUI design. Now unity has its own GUI in 5.x. Is there any easy way to implement GUI animation with unity GUI?
For example, in NGUI,
How can I implement these with unity GUI?
Upvotes: 1
Views: 1054
Reputation: 392
You can animate GUI objects like every other object in Unity. Just attach an Animator and a Controller, add a parameter, and make an animation in the Animation window in unity. On button press can be done in a script, if you want keyboard input. Or with a function call - to a script - if you mean a GUI button.
Animation window can be found in Windows -> Animation
Ill add an example if needed.
Keypoints: The Trigger parameter, as the condition in the transistion into the animation state.
This makes it possible to add this line into the code:
anim.SetTrigger("Fire");
To play the animation.
Last but not least, ill add a video guide: https://www.youtube.com/watch?v=JeZkctmoBPw If that one wasnt good enough, one can always click around.
Upvotes: 3
Reputation: 6406
Unity GUI works in a different way to most GUIs. Instead of setting up a button which then remains there until ether you tear it down or user interacts with it, on every frame it asks you to draw the GUI objects.
So animation is inherent. If you want a button to flash, simply draw it in a different colour every ten frames or so. If you want it to move, update it's x, y co-ordinates.
Upvotes: -2