- Home /
Question by
Bentoon · Jun 07, 2015 at 03:35 AM ·
c#scene-loadingdontdestroyonloadreturn
Return to a specific scene & position
Hellooo
I have a few short scenes that can be loaded from several other scenes.
I need to return to the right level when done...
& keep the players Position... But the "Player" is only a camera on an iTween path so DontDestroyOnLoad( gameObject ) might be tricky
I'm in C#.
Can I put a script on an exit collider in the new scene like so:
public string oldLevel;
void OnTriggerEnter(Collider other) {
Application.LoadLevel(oldLevel);
}
And how would I return to the old scene with the players position intact?
I think I can access the iTweenPath.percentage
Comment
Just save iTweenPath.percentage in PlayerPrefs with the level name as the playerprefs key. On each level load, load the value from the PlayerPrefs and set it to the iTweenPath.percentage.