Ok I have a problem which should be easy to solve.
I have this building that when you enter it, a new level loads with your player in it. The problem comes with placing the player in the new scene in a specific position away from the door so he doesn’t go back out when the new scene loads. My player pretty much does not move an inch. Technically still outside even after the new level loads.
So How would I do that?
The code I have isn’t working. By not working I mean it has no errors, instead it just does not do what I need it to.
My code for the Entrance/Door:
public string nextLevel;
private Transform plyrObject;
//enterPoint is the point where the player is supposed to be positioned after entering.
public Transform enterPoint;
void Awake(){
GameObject.DontDestroyOnLoad(this.gameObject);
// Posotion player after entering:
plyrObject.position = enterPoint.position;
}
void OnTriggerEnter(Collider col){
if(col.tag == "Player"){
Apllication.LoadLevel(nextLevel);
playerObject = col.transform;
}
}
}
HALP!