good morning!
So currently I’m using Cinemachine as a Camera Follow for the player. Both my player and Camera+Virtual Camera are kept persistent through scenes using “DontDestroyOnLoad.”
My only issue is, when my player enters a new scene, the Virtual Camera won’t adjust to my player’s new position until I move, causing this really jarring pan across the whole scene to get the player in frame when I do move.
I tried adding the below script to my virtual camera, but nothing seems to have changed.
Any ideas?
public class FindPlayerAtStart : MonoBehaviour
{
public Transform playerPos;
private void OnEnable()
{
SceneManager.sceneLoaded += OnLevelLoaded;
}
private void OnDisable()
{
SceneManager.sceneLoaded -= OnLevelLoaded;
}
private void OnLevelLoaded(Scene scene, LoadSceneMode mode)
{
float x = transform.position.x;
float y = transform.position.y;
x = playerPos.position.x;
y = playerPos.position.y;
}
}