(SOLVED) My object not showing

so Im creating new UI for my game but when I switch it to the GUI layer the object does not show in the preview while it shows in the editor. the rest of the objects in the GUI layer show up

We might need a little more info. Are there events? Do they move objects or change the z-order? Check the z-order. I’ve had objects disappear and it turned out they had the same z-order.

Well yeah the object is on another layer but they show in the editor and when i switch the UI’s layer to the base layer it does show in the preview i’ve also tested with other objects but same results it shows when in the base layer and not when i switch to the GUI layer ive also tested the z-order thats not it.thanks tho

How do you switch it to the GUI? Via the editor, or using events? Are you doing any camera movements on the other layers? If with events, make sure the co-ordinates of the object are in the camera range of the GUI layer.

If you run it in debug mode, is there an instantiated copy of the object? Is is marked as visible? Can you post all events that reference this object if none of these suggestions help?

I switch the object to the GUI via editor and yes there are camera movements for the player and and npcs but none for the GUI .the aldready existing UI work fine and even if you put another
object on another layer it still does not show up and when i put it in the debugger it shows as visible i even tested it and put a collision event to see if the object still exists but not visible and the collision event works so its still in the game but not visible ant there are not events that reference it

also none of the other objects in any other layers show up while it does for the base layer layer

Are you moving the camera on the GUI layer (I’m hoping the answer is “no”)? What are the co-ordinates of the missing object and what are the boundaries of the GUI camera (you may need to output those to console using the debug to console action). Check that the co-ordinates of the object lie within the GUI camera boundaries.

A brief explanation on cameras - each layer has a camera. This determines what area of the layer is presented to the screen. A camera on one layer can be in a different position to a camera on another layer, but the area each camera covers is placed on the screen. Typically with scrolling games that have a GUI, the camera on the playing layers moves, while the camera on the GUI is fixed. So an object that is on the screen on the playing layer may be off screen if it is placed on the GUI layer.

In the diagram below, the green border represents the GUI camera, and the red border the game camera. The white X will show on screen when it’s on the game layer, but not when it’s on the GUI layer because it is outside the GUI camera boundaries.

Make sure your object is not like the white X.

OK thanks so so so so much i got it to finally work because of you
i am super thankful it was a stupid mistake and i put the object in the white box
you see the other UI which was health was on the edge of the screen worked so i was pretty confused but i got it working thanks