public static void AddTo(GameObject obj) { StateStorage storage = obj.GetComponent <StateStorage>(); if (storage == null) { storage = obj.AddComponent <StateStorage>(); } storage.Store(); }
public static void Store(this Transform t) { StateStorage storer = t.GetComponent <StateStorage>(); if (storer == null) { storer = t.gameObject.AddComponent <StateStorage>(); } storer.Store(); }
public static StateStorage Revert(this Transform t) { StateStorage storer = t.GetComponent <StateStorage>(); if (storer == null) { storer = t.gameObject.AddComponent <StateStorage>(); storer.Store(); } return(storer); }