Instantiated Child objects don't appear in Game, but visible in scene

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.

My first suggestion is to check the order number on your sprites.

If that don't solve your problem check your Camera. It can be not rendering everything. Check your Culling Mask option. Select "**Everything**" to do a quick test.

Also on your Camera component, check the values of your Clipping Planes. It can be cutting part of your objects.

Hope that solve your problem.

Guys, if that not solve your problem, you can change the camera projection from perspective to orthographic. That solved my problem.