- Home /
I need to teleport a FPS chara controller
How to teleport a character? I mean the player from a scene 1 to a Scene 2?
And is it possible to link the triggers,variables or switchs between two scenes?
Thank you.
Answer by Jesse Anders · Feb 12, 2011 at 10:02 PM
And is it possible to link the triggers,variables or switchs between two scenes?
Of course; very rarely is it 'impossible' to do something of that sort.
To 'teleport' the character from one scene to another, you'll want to use Application.LoadLevel() to load the new scene, and then (if necessary) position the character at the appropriate location in the scene.
As for data that persists between levels, here are three options:
- Static member variables
- DontDestroyOnLoad()
- PlayerPrefs
listen I've made a script here but it doesnt work here is it :
function OnTriggerEnter(other : Collider) { if (Input.Get$$anonymous$$eyDown ("e")) Application.LoadLevel (1); }
function Awake () { DontDestroyOnLoad (transform.gameObject); transform.position = Vector3(71,79,-456); }
Is there anyway you can tell me what's wrong with it? or even tell me what script i should use?
You don't want to use Get$$anonymous$$eyDown() (or the Input class in general) in OnTriggerEnter(), I don't think. One way or another, you'll probably need to rearrange your logic so that the collision is detected in OnTriggerEnter(), but checking for input happens in Update().
Answer by Moltvatch · Feb 12, 2011 at 10:45 PM
Ok thank you then!
please, this is not an answer, use comments to comment or thanks for something, answer as the name says is to answer a question not to thank for something.
I'll call you when I need some idiot to make me advices.
Thanks for the thank you :) But please, don't be rude to your fellow forum members. Posting a comment or reply as an answer is a common mistake - no biggie. Uriel was just making you aware of how the forum works for next time.
Your answer
Follow this Question
Related Questions
Teleport the player from A to B 2 Answers
How Move Player between Scenes? 7 Answers
FPS Character with model 6 Answers
I CANT FIND THE OBJECTS IN MY SCENE! Please HELP 1 Answer
How to keep same player settings from the scene in the .exe file 0 Answers