private void OnDestroy() { if (parent != null) parent.RemoveBone(this); parent = null; }
/// <summary> /// Changes the parent animation of this component. /// </summary> /// <param name="animation">New animation parent, can be null.</param> /// <param name="isInternal">If true the bone will just be changed internally, but parent animation will not be /// notified.</param> internal void SetParent(Animation animation, bool isInternal = false) { if (animation == parent) return; if (!isInternal) { if (parent != null) parent.RemoveBone(this); if (animation != null) animation.AddBone(this); } parent = animation; }
private void OnDisable() { if (parent != null) parent.RemoveBone(this); parent = null; }