Teleporting problems
I'm trying to teleport to a new scene from another scene. My problem is that when i go into the new scene i teleport to the location of the first person controller. I want to be able to teleport to a different location in that scene. For example : I currently am in scene 1 and want to teleport to scene 2 on gameObject. Maybe i'm doing it wrong and there is a better way. My script you see below is my attempt at trying to do this. With my basic understanding of scripting it is most likely wrong. For anyone who has seen my last post i just want to clarify that the only reason i am posting again is because i did not explain my situation properly and did not get the answer i was looking for at all. For that i am sorry. For anyone that can help me please understand i am new and don't know terminology and things of that sort. If you could show me what i am doing wrong or tell me what i should look up would be a great help!
pragma strict
var NewScene : String;
var target : Transform;
function OnTriggerEnter(Col : Collider)
{
if(Col.tag ==("Player"))
{
Application.LoadLevel("Beach");
this.transform.position = gameObject.tag == "teleport1".position;
}
}
Answer by Cuttlas-U · Apr 10, 2017 at 05:07 PM
Hi; create a new game Object in the second scene and set it position to where u want your player go after loading the scene; then attach a script to in and int the Start() method Find the player Object and Set the player position to that object u set; like this :
void Start()
{
GameObject.Find("Player").transform.position = transform.position;
}
Thank you very much for the help! Good help is hard to come around these days apparently.
How would i make more spawn points in one scene ?