//I don't use a static constructor since I need the delegates to be loaded immediately, //but static constructors don't guarantee when they're run. public static void Prepare() { typName = typeof(T).Name; SceneIntermediary.RegisterSceneLoad(CreateParticleContainer); SceneIntermediary.RegisterSceneUnload(OrphanAll); Pooled <T> .Prepare(GetContainer); }
public void TakeParent(Pooled par) { //false maintains the local transform. we want to maintain the local rotation/scale tr.SetParent((parent = par).tr, false); tr.localPosition = Vector3.zero; parent.dependents.Add(this); parented = true; }