Hi, in my game project I’m facing an issue where the ‘health bar’ sprite object is appear on some objects and not on others. This is what I’ve done already…
I’ve attached my ‘health bar’ sprite to another sprite prefab as a child, configured the behavior and tested it. It worked fine (life goes down when attacked).
- When I place the unit object prefab in the scene, everything renders properly and behaves as expected. You can see in the image below three different colored beetles facing upwards with health bars.
- When I instantiate the prefab randomly (as my enemy) it also appears and behaves properly.
- When I instantiate the prefab for the player on mouse click, the object is created as expected… but as you can see below, the ‘health bar’ is visible in the scene and not the game.
I’ve tried comparing Z values; changing rendering- layers, order, texture; camera settings; and the code for instantiating the prefabs for enemy and player are the same as well.
Not sure what else to try.