Hola buenas a todos, tengo un problema estoy haciendo el sistema de guardado y tengo este script y no se como cargar la escana guardada sin que me de error de que el index es -1 o violación de el archivo de datos esta en la función cargar¿que devo poner para que me carge la escena con este script.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class JuegoManager : MonoBehaviour {
public static JuegoManager juegoControlador;
public GameObject Coche1Inst;
public GameObject Moto1Inst;
private AsyncOperation Asyn;
private Button Coche1Boton;
private Button Moto1Boton;
public AudioClip audioClipMusicaScena01;
public AudioClip audioClipMusicaScena02;
public int puntosSalt;
private Text textoPuntos;
public int puntosMax;
public string rutaArchivo;
public string sceneName;
public Scene scene;
public static JuegoManager juego
{
get; set;
}
private void Awake ()
{
textoPuntos = GameObject.Find("Puntos").GetComponent<Text>();
rutaArchivo = Application.persistentDataPath + "/data.dat";
if (juegoControlador == null)
{
juegoControlador = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
private void OnEnable()
{
UnityEngine