Got a question, I have the DoNotDestroy on load working and I’ve attached Char to a SpawnPoint to sort out Vector’s on load all is working fine. The only issue I have is the camera Script uses a Transform to attach to the Player and I can’t find away to attach it back automatically on Application Load Level, the Scene Asset ( and Transform point) doesn’t exist until the scene is loaded.
If I do a DoNotDestroy with tag MainCamera, things get weird and I can’t seem to tell the Camera Script to attach to the target automatically because it flags an error attaching the Transform to a GameObject Asset. Can anyone help?
I usually have a “scene controlling script” that acts as the controller for whatever scene is loaded. If you have this controller, you can attach the main camera to your carried-over Character during the Start function of the controller.
Something to the effect of:
public void GameController: monobehaviour {
public void Start() {
var character = GameObject.Find("Player");
Camera.mainCamera.transform.parent = character.transform;
}
}