so I have two levels where my player goes, gets points returns home then goes out again (in a repetitive cycle)
i have the player coming across and transferring values correctly, but if i return to a scene ive already been to, my player multiplies (so if ive been there once then when i go back ill have two then 3 etc)
so my question is, how do i make sure that ill only ever have just the one character. my code is this
void OnCollisionEnter (Collision objectHit)
{
if (objectHit.transform.tag =="castleTeleport")
{
DontDestroyOnLoad (transform.gameObject);
homeTeleport ("castleScene");
}
}
public void homeTeleport (string LevelNameToLoad)
{
Application.LoadLevel (LevelNameToLoad);
}
↧