Hey, I know Sam explained it how to put in the Damage Text if using a newer Unity version, but I don’t know what he means with root of my prefab. For now I can’t put in my DamageText script into the Damage Text Prefab Serializefied in Unity. Where I have to put my DamageText script in order to show the Damage above the heads? I did the extra edit exactly how he explained it. Where do I have to put in the DamageText script if using a newer Unity Version?
The root of the prefab is the highest level parent GameObject. The one that remains visible if you close all the dropdown arrows in the prefab hierarchy. So, not the Canvas or Text objects. With everything being called ‘Damage Text’ it’s a little hard to explain (I named all mine a little differently).
That makes sense, but in the Damage Text Spawner GameObject I only have “Damage Text Spawner”. I added the Damage Text in but still can’t put it in. Maybe a Screenshot will help. That’s how my Damage Text Spawner looks like right now.
Unity also gives me this error if I attack an enemy or an enemy attacks me
The DamageText script needs to go on the (root of the) Damage Text prefab, and then we connect that prefab to the DamageText serialized field in the Damage Text Spawner prefab. The null error is probably from not setting the serialized field in the Damage Text Spawner prefab.
Well okay that worked, but the damage numbers are not showing. Is that fixed in a later lession or did I do something wrong in some scripts?
The damage numbers might be fading out from the animation too quickly (it was for me). You can try pausing as soon as you start, or slowing down the animation by lowering the Samples in the Animation window
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.