Загрузка страницы

Floating Text in Unity

Harness the power of showing Damage Popups, or command your NPCs to tell you they love you by implementing Floating Text in this Unity Tutorial.

✨Want to support the channel?
Buy me a coffee ☕: https://ko-fi.com/bmoli

➤Join our DISCORD SERVER: https://discord.gg/pMrMshh
We have channels to help you with your problems!

➤SUBSCRIBE to learn more game dev

➤Object Pooling Tutorial Mentioned: https://youtu.be/nf3gXt5m3Fc
0:00 Tear-jerk Intro
I love you.

0:20 Setup FloatingText object
The first thing we need to do is actually create our Floating Text GameObject and set it up with the look and feel we'd like before we start animating it to do interesting things like move / rotate / scale, etc.

We just need to create an empty GameObject and add a TextMesh component.

1:31 Text Animation
Using Unity's built in Animation system, we can very quickly record adjustments made to our FloatingText object to add interesting behavior to our text popup. This involves:

1. Sliding the text up to give it the signature "floating" effect, can also start to fade out visually over time.
2. Scaling the text from small to large to small again, to give off an inflation effect, this gives the text a weighty feel.
3. Rotating the text to give more visual interest as the text gets instantiated.

Feel free to get as creative as you can! Share any useful techniques you pickup :)

3:55 Stop Loop
Make sure to disable Looping from your Animaton (it defaults to On), unless you intend for it.

4:14 Spawn FloatingText
With our FloatingText GameObject setup and animated, we now just need to create it where we want to. In my example, I want to use it when dealing damage to an Enemy, but it doesn't have to be. It could be generated when walking by NPCs, or when you want to quickly display any information visually to the player.
8:09 Hide FloatingText
Finally, with all components of our FloatingText in place, and it generating where we want it to, we just need to hide it. The correct way to do this if you plan on instantiating many of these FloatingText prefabs frequently (like I do in my damage popup example), would be to use Object Pooling as constantly creating/destroying wastes memory.

For this video I just simply create a DestroyInSeconds script you can attach to any GameObject that will destroy itself after a set duration (defaults to 1 second).

9:10 Subscribe-provoking Outro

LIKE if this helped you out! (Please, this helps the video and channel out)
JOIN DISCORD if you need help or want to talk with many other learning developers!
SUBSCRIBE for more game development content and tutorials!

#bmo #unity #tutorial

Видео Floating Text in Unity канала BMo
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
15 ноября 2020 г. 17:51:45
00:09:34
Яндекс.Метрика