Hi,
Sorry for the post bombing, but I have some issues that have laid dormant and now I am cleaning things up.
I click on a hotspot and the camera switches to a Game Camera 2D Drag.
However, when I enter play mode, the 2D Drag camera changes its position. When I made this scene it worked fine(i.e. camera didn't change position in play mode) , but as I haven't been back to this part of the game in a while, I just noticed this behavior. I haven't updated Unity (2021.3.8f1)
It seems that the camera changes it's local positions as:
X: XposLocal same as before, but newXGlobalPos = close to 0
Y: editorYposLocal + editorYposGlobal => newYGlobalPos (0)
Z: editorXposLocal + editorXposGlobal => newZGlobalPos (same as before)
Have I mistakenly changed any of the settings?
I tried to replace this camera with a new "Game Camera 2D Drag"-prefab, but the result is the same.
The issue does not happen when the Lock State is set to free (currently limited).
Adding the Remember Game Camera 2D Drag component doesn't change things.
// Magnus
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I'm not clear of the "Position (world)" annotations in the screenshot - is this to say that the Transform component values are local, with the GameCamera being attached to a moving object?
Test the behaviour with no parent, if so - as it could be interfering.
Try also setting relying on Orthographic projection - which uses a different algorithm, and also allows you to assign a background sprite to act as a constraint.
The game camera is attached to a static object so has a local position in relation to this., and Position (world) refers to its Global transform position.
I tried with the AC prefab with no parent (orthographic) but still the same behavior. It jumps out into the universe when entering play mode.
But, I also did it with a background sprite as a constraint and then it works great, both with and without parent. Much better solution. Thanks for this!