Example #1
0
    void Awake()
    {
        //obtenemos ruta
        rutaArchivo = Application.persistentDataPath + "/datos.dat";

        //Si es la primera vez
        if (variablesPersonaje == null)
        {
            //Referencia al componente que ejecuta el codigo
            variablesPersonaje = this;

            /*
             * Objeto que no se destruira cuando cambiamos
             * de escenas
             * */
            DontDestroyOnLoad(gameObject);
        }
        else if (variablesPersonaje != this)
        {
            //Destruyo componente que tiene el script
            Destroy(gameObject);
        }
    }
Example #2
0
    void Awake()
    {
        //obtenemos ruta
        rutaArchivo = Application.persistentDataPath + "/datos.dat";

        //Si es la primera vez
        if (variablesPersonaje == null) {

            //Referencia al componente que ejecuta el codigo
            variablesPersonaje = this;

            /*
         * Objeto que no se destruira cuando cambiamos
         * de escenas
         * */
            DontDestroyOnLoad (gameObject);
        } else if (variablesPersonaje != this) {

            //Destruyo componente que tiene el script
            Destroy(gameObject);

        }
    }