[Solved] I cant make object follow camera

how do i make a object follow the camera aka the ui/gui

it shoud follow the camrea position with no movment

but instade when i do it it ether dissapears or dosent follow it

i allready did the “put it in a ui layer” it dosent work

plz help

Putting it on a UI layer works for me.
Unless I forgot to select the object instance and move it to the UI layer.

Do you have any events that would cause the UI layer to move?

the only camera event is the camera to follow the player
Screenshot 2023-02-15 105305

Do you have the UI/GUI objects on another layer, as @Lucky-j suggested? If your UI/GUI objects are on the base layer that also has the player, then it will never stay on screen as the player moves.

they are on the ui layer still dosent work

What do you mean by this. It doesn’t follow any camera. The point of the UI/GUI layer is that it’s camera doesn’t move, and so the objects on the layer don’t change position on screen.

So you must be moving the camera on the UI layer. Can you give a screen shot of the object and it’s properties in the panel on the left hand side?

And a screenshot of all the events that move any camera.

nah like i put the ui element on the editor i channge it to the layer UI and then when i play test it it dissapears or just dosent move at all

Then somewhere in your events you must be moving the camera for the UI layer.

In which direction does it disappear relative to the player’s movement direction? Same way, opposite, something else?

If it doesn’t move, isn’t that what you want?

its just dissapears i cant find it
you know just message me on discord how about that

I’d rather keep it on this forum, so if anyone else has a similar problem then they can follow this thread to it’s conclusion.

Would you care to share your project? Or event just the game.json file? PM me if you’re not comfortable sharing it publicly.

how do i pm u am kinda new to this forum thing

Put the file or the zipped project folder on a file share service (like drop box, Google drive, MediaFire, Mege.io etc) and post/PM the link.

https://drive.google.com/file/d/1ikKAUnBmtZ8NCE6TUrc_uCNQHnU2q5jK/view?usp=share_link

Which scene? There are about 30, and I’m not going through them all :smiley:

1 Like

hah ya
its shoud be L1W1/L2W1

Firstly, you’re linking the events for L1W1 in L2W1.

Don’t. Remove the link. Both event scripts will be referencing different objects. You can link external events that use L2W1 as their base scene. But don’t link to events that belong to another scene.

Secondly, you are moving Hearts to the CameraBorderLeft() and CameraBorderTop(). These two functions take layer and camera as parameters. If you don’t give values for the parameters, default values are used. In this case, layer defaults to the base layer. And the base layer camera is far, far away from 0,0. Use “UI” and 0 as the parameters instead.

However, What you should really be doing is placing the UI objects in the grey rectangle in the editor that starts at 0,0 and is the width and height of the game resolution. Then you won’t need to move them. In the image below, I moved the hearts objects to 0,0 (and changed the background to black so the outline is easier to see). That grey outline is the screen dimensions.


Finally, in the events you are placing hearts on the layer Fiebase::GetUserUID(). Why? Who knows on which layer it will place the hearts. Get rid of that line:

image


Note, because I only have the game.json, none of the images are in the scene, hence the blank, black scene with no graphics/images.

1 Like

nope i did all the steps it just dissapears, is it the Z value or smthng?

Z order determines the object’s placing/drawing order coming out of the screen. It has nothing to do with this problem. It’ll be that you haven’t done it properly. Did you:

  1. Remove all of these actions image

  2. Remove the link image

  3. Remove the firebase reference image

  4. Reposition the UI objects to be within the grey rectangle in the editor, so they are placed within the rectangle bound by 0,0 and 1312,738?

Additionally, you’ve got ASCII effect on the UI layer. You may want to turn that off.


I’ve done the above actions on your original game.json, and it works fine.

ok i dont know if its my fault but it works on other stuff but when i do it for the hearts it dosent appear, why do you think that happens?

nvm i fixed it tnx u really helped :grinning: