well, you don't need to be using PlayerPrefs, that's more for saving game data between sessions. If you create a static var, that won't be lost when you change scenes.
var player : Transform;
static var currentCharacter : Transform;
var respawn = GameObject.FindWithTag ("Respawn");
player = Instantiate (currentCharacter, respawn.transform.position, respawn.transform.rotation);
yes, each time you run this, it would instantiate another copy..
so if you are going to instantiate a different character, you would want to destroy the previous..
by using "player =" above, I am setting my var "player" to the object instantiated,
so I can access its scripts now by
var myScript = player.gameObject.GetComponent(MyScript);
myScript.DoSomething();
myScript.someFloatVar = 0.5;
EDIT:
forgot, as for the position/rotation, no you don't need a "dummy" character to start..
above, we are adopting the spawnPoint's transform, with
...respawn.transform.position, respawn.transform.rotation);
↧