Problems moving objects between layers

I have my level on the base layer and a menu as GUI layer.
I want to drag and drop found items from the level in the menu, using the Draggable behavior. And also in the other direction, putting an item out of my backpack into the world.This works fine as long as the level is not moving.
But when I change the camara positon with follow the player or DragCamera extension, it doesn’t work anymore. Sometimes it flickers, jumps and other very broken behavior.
It looks like the menu object’s graphic is still in the right place, but the hitbox is moved with the base layer! I’ve also tried not using 2 layers and keeping the menu on place with the current camara position, but it doesn’t help…

Is there a reasonable solution or trick?
This is really annoying and causes problems in many different game concepts.


When you place an object on another layer, you need to take into account the difference in camera positions for each layer.

In this example, I’m dragging an object named Draggable in the “UI” layer, and dropping it onto the “Editing” layer:

Ah I don’t know how to use that in my case, sry.
Maybe you can try to insert it.
project link removed

Try this - it works if the bar object is on the GUI layer (but not if the bar object is on the base layer).

1 Like

I can’t say I really understand how but it works fine, thanks!
Now I have to reach that the items can only be moved into the bar with the mouse and don’t colide automatically when I move the level :thinking: right-mouse-button-is-not-down in all 3 events works, but when I release the button, the items behind the bar of course will jump into the bar. If you know how let me know, it’s kinda more complicated than anything I’ve done before :exploding_head:

Instead of using RMB down, make the events a subevent of an item-is-being-dragged event.

1 Like

That works, thanks.

Now I have another problem with it.
I don’t want to drag the layer when I drag the item and I don’t want to trigger a button when I drop an item on it.
This only works as long as only one instance of “item” exists.
I have already tried For each object and Pick all objects

Yes, because if there are two item objects, the cursor will always not be over one of them.

Try the following, I think it should work:

1 Like

Great, it works, thanks :slightly_smiling_face:

Now I want to move my world with the mouse, but don’t trigger random buttons and clickable objects in it when I release the button.

It doesn’t work.
(I can not check alternatively if the camara position has been changed. Because at the edge in the cam limits, we drag but the position stays the same.)

If we can get it to work, one problem remains. Any small movement when clicking a button will prevent it from being clicked.

Can you set a boolean variable when you are dragging to indicate dragging is in progress? Then when mouse button it released, make sure that boolean variable is false before actioning the button click.

I think that’s the problem, how detect that it’s being dragged? (the cam with the extension, not an object with its drag behavior)

If you can’t do it with the camera drag extension, then I’d do it once the LMB goes down; if it’s not on a button then set it to true. Or is this too simplistic?

Bc the limits, it can also start outside a button and be on a button (or on another), when released.
I also want to drag the cam when the click starts on a button and ends on an button. But he shouldn’t be pressed because I dragged. The normal behavior in any mobile game with a moving scene, I think.

Maybe I can use a timer, if mouse down and mouse up takes more than 0.5 seconds, it was probably a drag and not a tap. But is also not really reliable.