/// <summary> /// Creates a clone of an existing anchor and adds it as a child of source /// </summary> /// <param name="source">the anchor to be cloned</param> /// <param name="parent">the new parent of the clone</param> /// <returns>the new anchor</returns> public MBAnchor AddAnchor(MBAnchor source, MBObject parent) { if (!parent.Matches(typeof(MBParticleSystem), typeof(MBEmitter), typeof(MBAnchor))) return null; if (parent is MBEmitter && ((MBEmitter)parent).IsTrail) return null; if (source) { MBAnchor anc = (MBAnchor)Object.Instantiate(source); // initialize hierarchy anc.SetParent(parent); anc.mbReloadHierarchy(); anc.Transform.position = parent.Transform.position; return anc; } else return null; }
// Use this for initialization void Awake() { if (!Pool) Pool = GetComponent<MBAnchor>(); }