transition between scenes

Hi everybody!

Maybe i is a really stupid question but i'm tortaly new to unity.... I have a scene with abuilding that has an infodesk.The infodesk has a simple button that when pressed a new scene opens and the user can see the screen and interact with it.My prloblem is tha i need to create a button that when the user exits this scene he returns in the previous scene but exactly in the place he was before. Right now he returns in the main scene but in the entrance of my building and not in front of the infodesk...Thank you!

There's a couple ways to do this.

One way is to save the player's position to a variable on an object, along with DontDestroyOnLoad To keep it in existence in the new scene. This is good especially if you have various forms of data you might like to keep and reference across multiple scenes, or if you want sounds to continue playing, etc.

Another way is to make use of PlayerPrefs to store and retrieve data between scenes. This is particularly useful for communicating data across any scene order, or even temporarily saving information for return visits.

Edit: Clarification of DontDestroyOnLoad

This function is called in a script on the object you want to keep, telling Unity not to delete it, if another scene is loaded.

if you created an empty game object, you could put a script like this on it (javascript here):

static var savedPosition : Vector3;

function Awake(){
    DontDestroyOnLoad(transform.gameObject);
}

Unity will see your DontDestroy function as soon as the script awakens, and the object and the variable on its script will continue into any scenes that you load afterward.

since the savedPosition variable is static, you can reference it from any script easily, including setting it's value just before loading a scene.

one of the strengths of this method is that DontDestroyOnLoad protects its hierarchy, so you could, in theory, parent other objects to it interactively if you want them to endure to the next scene also.