- Home /
Setting Player positioning on a different loaded scene with Dont Destroy On Load attached.
I need to keep my Player's settings intact so I use the DontDestroy command. The problem is when using triggers to move in him scene to scene, the script I use to place him in the correct positioning does not work since it never resets. For example, this is the Java code I use to have him spawn at a marker at the start of each scene...
var mySpawn:Vector3;
mySpawn =
GameObject.Find("Spawn").transform.position;
transform.position = mySpawn;
But like I said, even though there is a "Spawn" marker on each scene, because of the Dont Destroy also placed on the Player, my Java script never resets so it can only be used once and I don't know how to get it to refresh. I read about how the OnLevelWasLoaded works and it sounds like it's what I need, but whenever I try to throw that function in my code (top line), it breaks it for some reason and doesn't work at all. I've read in a couple other threads as well but nobody is using the Dont Destroy attached to their character or they're relying on a collider for it to trigger which wouldn't work on my part. Any advice would be appreciated, I've been at this for hours. It could even be C# and that would be great. Thank you anyone.
Your answer
Follow this Question
Related Questions
Player using Dont destroy on load 1 Answer
Teleporting Player to a point using box colliders 1 Answer
how to make a character resume after going into a random battle? 1 Answer
Writing my own enter/exit car - need help. 2 Answers
Camera following the player in 3D - in object hirarchy or through scripts? 1 Answer