Gameobject not display while click play button

the laser object not display while click the play button, there is no error appear in the console, and i face the same thing for the player, but by changing the z value i solve the problem, however i change the z value in the laser prefab still not working.

anyone have ideas?

Hi knigtsu,

Welcome to our community! :slight_smile:

Is the “missing” laser game object in your Hierarchy after you clicked the Play button? If so, there might still be a problem with the z-position.

Is the z-position of the background set to 10, the z-position of the camera to -10 and the z-position of the other game objects to 0?

yes, and the problem is with the Z position. but the camera is at Z: -10 and background is at Z: 0, player at Z:-6, the player laser is at z:-4 which is i manually set, but once click the play button the player laser object get created in the hierachy tab (left side) but in the game window the laser not displayed.

plus: in the course the instructor did not set any z position intentionlly to overcome these problems. is there a easier way to handle these headaches.

Are those the position values during runtime? Maybe the lasers get instantiated at z = 0, making them get rendered either on top or behind the background which, too, is at z = 0.

If they aren’t instantiated at z = 0 but at z = -4, are there any error messages in your console? If there are none, check if the laser game object has got a SpriteRenderer attached. Only SpriteRenderers with sprites can be seen and rendered by the camera.

The instructor didn’t have to adjust the z-positions of the laser because his background is at z = 5 (or something like that). The lasers never share the same z-position as the background.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms