Esempio n. 1
0
 public static void NewLoadTrackFromPath(string path, ref TrackP track)
 {
     if (System.IO.File.Exists(path))
     {
         bool sucess = NewLoadFromFile(path, ref track);
         if (!sucess)
         {
             Debug.LogError("Failed to load " + path);
         }
     }
     else
     {
         Debug.Log("No path " + path + " found");
     }
 }
Esempio n. 2
0
    static bool NewLoadFromFile(string path, ref TrackP track)
    {
        bool sucess = true;

        try
        {
            string fileContents = System.IO.File.ReadAllText(path);
            track = JsonUtility.FromJson <TrackP>(fileContents);
        }
        catch (System.Exception e)
        {
            Debug.LogError(e);
            sucess = false;
        }

        return(sucess);
    }
Esempio n. 3
0
    public static void NewSerializeAndSave(TrackP track, string path)
    {
        string serializedBank = JsonUtility.ToJson(track, true);

        System.IO.File.WriteAllText(path, serializedBank);
    }