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.


![103997-screen-shot-10-18-17-at-0756-pm.png|305x329](upload://naS0m2lv2WoAOXUYnyndvWOOyjV.png)
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.


![103999-screen-shot-10-18-17-at-0801-pm.png|305x371](upload://gnjsfcCrBMKArFjkEuo7mgakchm.png)
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.