I make it in one string

2 Likes

I first had it pushed directly in from the spawner too, and it surely works.

One thing to consider though: The way shown in the lecture defines the SetValue() method to call, and this could easily be turned into an interface for any kind of text messages to spawn above a character’s head like the damage we show right now. and in fact, what gets spawned doesn’t actually have to be text at all. So we have a DamageText prefab (which accompanied script component) that offers this as an API to set the value, and it will do with it whatever it deems right.
For now we just have a text field with a number floating up.
For a different thing we might have an animation to represent some sort of bonus with 1-5 crowns showing that light up.

So it definitely makes sense to give out a generic SetValue() to be called from the spawner and handle the details on it completely opaque inside the spawned object.

Privacy & Terms