Saving and Loading a GameObject’s position

The following script can be attached to a GameObject to save it’s position when it’s Destroyed (this happens when the scene is changed, and when the application quits), and load it’s position when the scene loads.

using UnityEngine;

public class SavePosition : MonoBehaviour
{
    // Generate a unique ID for this GameObject.
    public string guid = System.Guid.NewGuid().ToString();

    void Awake()
    {
        transform.localPosition = ES3.Load<Vector3>(guid, transform.localPosition);
    }

    void OnDestroy()
    {
        ES3.Save<Vector3>(guid, transform.localPosition);
    }
}

Discussion

https://moodkie.com/forum/viewtopic.php?t=1889