//Hidden constructor protected Reta() { _GameObject = new GameObject(); _GameObject.transform.position = Vector3.zero; _GameObject.name = "_Reta"; //TODO: Check this shit, leak-prone GameObject.DontDestroyOnLoad(_GameObject); _Controller = _GameObject.AddComponent<RetaController>(); _Recorder = Recorder.Load(); _Connector = _GameObject.AddComponent<Connector>(); }
public static Recorder Load() { //See path string path = Application.persistentDataPath + "/recorder"; Recorder rec = null; //Create first if haven't if (!File.Exists(path)) { rec = new Recorder(); rec.Save(); } else { rec = (Recorder)XmlManager.LoadInstanceAsXml("recorder", typeof(Recorder)); } return rec; }