Really helped me understand the TextMesh! For those who are watching this as well, you could also add an event at the end of the animation in the animation tab and use that instead of creating a "DestroyInSeconds" behavior, but other than that, everything else was very helpful!!
Nice video. You mentioned object pooling, which would really be necessary in a real game where many of these are shown. Another approach is to use Unity's particle system to instantiate these texts, which would automatically pool them as well. That's a more complex setup, however. And for either of those approaches, it would be a good idea to separate out the UI and sound effects code from the health/damage code, which can be done using events that pass the health value to any interested subscribers. Again, a more complex setup, but by getting into that habit, you can be making systems that are independent of each other and yet plug into each other very easily.
Bit of a necro comment, but is it necessary to make a new script just to destroy the object? Can't you just put Destroy(prefab, 1f); in your ShowDamage function?
You sure can. However, if youre spawning quite a few of these at a time you may want to object pool it and disable rather than destroy. Perhaps you need more control over effects that can be handled in the script. The performance saved from not using a script is negligible, but you certainly dont need to if you dont want to
Love the way you explain this you are amazing!! I had 1 problome and that was that my transform was a rect transform. I didn't know why and didn't notice, but I could just remove it and it changed to a normal transform.
hello, if I am using TextMeshPro, should the code should need to change ? the pop up text did not change to the actual damage no., and the console showing : "NullReferenceException: Object reference not set to an instance of an object"
hey bmo can you do a video about draining life and showing a floating text that shows how much damage you dealt to an enemy using your old health bar video bar? like in terraria or 2d rpg games
When I try and follow this my text mesh just appears as an orange outline of the text. Changing the color doesn't actually change the text inside it and it doesn't show up in the scene. I have no idea what I'm doing wrong. Edit: Found out the Text Mesh use the Default sorting layer, so I had to either change it's sorting layer in code or make the default above everything else
Never questioned why taking damage always had to be negative. "I love you" damage just changed the game for me tysm bmo
He’s alive! Glad to see more videos dude!
Solid video on your first day back, keep it up!
Really helped me understand the TextMesh! For those who are watching this as well, you could also add an event at the end of the animation in the animation tab and use that instead of creating a "DestroyInSeconds" behavior, but other than that, everything else was very helpful!!
glad to see that u still making video, and the quality just keep on improving, really enjoy ur content
Very nice Tutorial. I started out with Unity 2 days ago and I could follow everything. Thank you very much
Hey glad your back.
Great explanations.
Helping me explore a different level.
That intro was so goooood :)))
Hey that really helped me. I am so happy that there are people like you out there who try to help.
BMo you are a top tier youtuber - good stuff
Thanks friend
Thanks man, I was really struggling with other tutorials
Straight to the point. Very helpful, thank you! :)
Thanks this helped a ton!
Why is there no option to change the layer order for Text Mesh objects? It appers behind my background and I cant find a single option to change it!
Thank you so much. It was easy to understand and it worked !
Nice video. You mentioned object pooling, which would really be necessary in a real game where many of these are shown. Another approach is to use Unity's particle system to instantiate these texts, which would automatically pool them as well. That's a more complex setup, however. And for either of those approaches, it would be a good idea to separate out the UI and sound effects code from the health/damage code, which can be done using events that pass the health value to any interested subscribers. Again, a more complex setup, but by getting into that habit, you can be making systems that are independent of each other and yet plug into each other very easily.
💯clean code keeps the demons away
Perfect! Exactly what I needed.
Thanks, You made my day!
So simple and so hard to find... Very very tank you!
Glad it helped!
Super helpful and clear thanks!
Sweet Dude
Nice tutorial! But I have one question is that how to change Text Mesh sorting layer in code to make it above everything else?
did you find out?
Thanks a lot! good video!!
Appreciate it 🙏
Awesome! I’ll put this to the test!, also,,,, first view and comment! (:
great tutor, i subcribe directly. keep it up👍👍
i was wondering can you make it so if you touch a object that its shows the text and if its possible how?
Have followed this and worked really nice, but when I build, there is no text / animation showing. Any idea why?
i love ur contents
hi, can you please tell about raycast hit the object and show dialogue box? if u can make video of it.
thank you
Bit of a necro comment, but is it necessary to make a new script just to destroy the object? Can't you just put Destroy(prefab, 1f); in your ShowDamage function?
You sure can.
However, if youre spawning quite a few of these at a time you may want to object pool it and disable rather than destroy. Perhaps you need more control over effects that can be handled in the script.
The performance saved from not using a script is negligible, but you certainly dont need to if you dont want to
@@BMoDev ah that makes sense, thanks for the quick reply!
Love the way you explain this you are amazing!!
I had 1 problome and that was that my transform was a rect transform. I didn't know why and didn't notice, but I could just remove it and it changed to a normal transform.
Thanks! You probably were using a UI text element as opposted to a GameObject with a TextMesh component
Hey, what is your VSCode theme?
my text doesnt show up as the animation
hello, if I am using TextMeshPro, should the code should need to change ? the pop up text did not change to the actual damage no., and the console showing : "NullReferenceException: Object reference not set to an instance of an object"
U need to at the top of ur code put using UnityEngine.TMPro;
hey bmo can you do a video about draining life and showing a floating text that shows how much damage you dealt to an enemy using your old health bar video bar? like in terraria or 2d rpg games
this doesn't work for me the text didnt show up.
Its Cile :D
Thank you :D My name is cole
Cile!!!!!!!
not working for 2d
When I try and follow this my text mesh just appears as an orange outline of the text. Changing the color doesn't actually change the text inside it and it doesn't show up in the scene. I have no idea what I'm doing wrong.
Edit: Found out the Text Mesh use the Default sorting layer, so I had to either change it's sorting layer in code or make the default above everything else
Thank you so much. It was easy to understand and it worked !