Camera not cented on start. #391
-
So i'm making a 2d game. The problem i'm having is that when starting the game the camera won't be centered on the player. The Camera will be where it's "pre-placed" in the scene and then jump to the players position. The reason this happens is because the player isn't spawned in right away when the game starts. So the camera doesn't have a target at first. (im setting the target in a script). Not sure how to fix this. I fixed the issue by setting the processing of the camera nodes to always. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Not entirely sure what the exact problem is. It sounds like an intended system behavior? Does the camera not center on the player once the target has been set? |
Beta Was this translation helpful? Give feedback.
If the
follow target
is set via code upon the scene starting, then that is an expected result. As the camera will be placed in the scene before the game runs and shouldn't move until it has a valid target to follow.If the timing is different when you change the
Process Mode
toAlways
, then that implies that the scene is not fully unpaused, i.e., it is still doing something in the background, when the target is being set via your code. So you are likely bypassing the scene instantiation flow by doing that. Am not sure if there are any risks involved with doing that.But, ideally, you would want to assign the target before running the scene — especially if the camera position is very diffe…