I recently made the camera follow the player in the game I’m making and all UI elements are staying in the correct position. I had a feature where the crosshair would transition to a cursor when hovering over the UI, during which you would not be able to fire your character’s weapon. This all worked until I switched the camera.
Now, it seems that the collision is staying on the base layer which moves under the player, while the UI elements follow the camera correctly. I can hover over an invisible area and it acts like the UI’s collision. The button still works properly, but the cursor transition does not.
How can I have the collision move with the camera?
That sounds like you’ve put the UI objects on the same layer as the paying objects. If my understanding is correct, then add a new layer and move the UI objects onto that. In the events, remove any of the events that move the UI objects and only scroll the base layer. That way the UI layer stays on screen the whole time and you won’t have to reposition the UI objects.
Then use the events that @weadsy1 posted to control the game play as you are after (add a trigger once to the first one to prevent UI cursor object being created)
In which case @weadsy1 solution will be the way to go.
But I’m confused by what you mean when you wrote the UI elements are staying in the correct position then. You’re not scrolling the UI layer and moving the UI camera?