Changing scenes works until I use a title screen
My scene changes work find when I play the game from my overworld scene. I have a test house and a cave, and I can go into both and come back out just fine. However, I've added a title screen-- when I click "new game" I'm able to load into the overworld. I can go into house/cave, but when I come back out, I'm thrown to some weird position off my map. I've done some debugging, and I am changing scenes back to the overworld. I think the problem is in my PlayerStartPoint script (I have box collider triggers to enter the house/cave and exit, at which point it sends me to one of my start points which aren't triggers), which I have attached. When I go from title>>>overworld>>> house>>>overworld, it can't find my transform.position. But when I load straight into the overworld, it prints the all the positions (upon entering house/cave, upon exiting house/cave) to the console. Can anyone help me figure out why this won't work when I have a title screen?
using System.Collections.Generic;
using UnityEngine;
public class PlayerStartPoint : MonoBehaviour {
private PlayerController thePlayer;
private CameraController theCamera;
//public Vector2 startDirection;
public string pointName; //name of point where player is starting
// Use this for initialization
void Start () {
thePlayer = FindObjectOfType<PlayerController> ();
if (thePlayer.startPoint == pointName) {
thePlayer.transform.position = transform.position; //where is this coming from???
Debug.Log (transform.position);
//thePlayer.lastMove = startDirection;
theCamera = FindObjectOfType<CameraController> ();
theCamera.transform.position = new Vector3 (transform.position.x, transform.position.y, theCamera.transform.position.z);
}
}
// Update is called once per frame
void Update () {
}
}