How to create UI animation with code in Unity | UI Tweening

Published: 17 June 2024
on channel: Christina Creates Games
3,165
154

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... [affiliate]

✍️ Github
https://github.com/Maraakis/Christina...

💬 Discord 💛
You are very welcome to join!   / discord  

🛍️ 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/hi... [affiliate]
Humblebundle: https://www.humblebundle.com/?partner... [Affiliate link]
Synty Store: https://syntystore.com/98327 [affiliate]

🎮 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


Watch video How to create UI animation with code in Unity | UI Tweening online, duration hours minute second in high quality that is uploaded to the channel Christina Creates Games 17 June 2024. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 3,165 times and liked it 154 visitors.