Animate your UI elements in Unity by code! We'll use tweening for this, but won't use any outside asset and instead write our own. We write a script that handles the animation of an element's position and alpha and go a step further by visualizing the locations it will end up in with Gizmos. That takes a lot off guesswork out of finding the correct distances and placements when creating your UI.
You will learn:
- How to move a UI element by code (tweening)
- How to animate position and alpha by code
- How to work with Gizmos (Visualisation Helpers)
- How to use the [Button] and [ShowIf] attribute of Odin Inspector in case you have the asset (it is not needed for this tutorial, but I enjoy working with it and maybe you do, too)
- How to use [ContextMenu] to create quick access to methods in the inspector for testing
Get Odin Inspector here:
https://assetstore.unity.com/packages/tools/utilities/odin-inspector-and-serializer-89041?aid=1101lr4hF [affiliate]
✍️ Github
https://github.com/Maraakis/ChristinaCreatesGames/tree/main/UI%20Tweening
💬 Discord 💛
You are very welcome to join! https://discord.gg/Gy7a9h3APK
🛍️ Affiliate links 🛍️
If you'd like to support my channel, please use my affiliate links when buying cool stuff:
My favourite assets I install by default into every project: https://assetstore.unity.com/lists/highly-recommended-9071944798250?aid=1101lr4hF [affiliate]
Unity Asset Store: https://assetstore.unity.com/?aid=1101lr4hF [affiliate]
Synty Store: https://syntystore.com/christinacreatesgames [affiliate]
🌟 Need help with your project's UI?🧠
I have been a designer for more than 15 years, a teacher for three and I offer paid consulting for your project! You can find all the information here:
https://www.vennegerts.com/gamedevelopment-consulting/
I am looking forward to hearing from you 💛
🎮 Play my games on Itch.io 🎮
https://christinacreatesgames.itch.io
🔖 Chapters ℹ️
00:00 The results of this tutorial
00:53 Core setup
01:21 Creating the animation script
08:27 Testing the ui animation results
09:06 Preview of the visualizations
09:33 Creating the visualizations with OnDrawGizmo
14:31 Conclusions
#unitytutorial