protected virtual void ParentChanged(Node oldParent, Node newParent) { if(oldParent != null) { oldParent.RemoveChild(this); if (NodeDetachedEvent != null) NodeDetachedEvent(this); } if (newParent != null) { newParent.AddChild(this); if (NodeAttachedEvent != null) NodeAttachedEvent(this); } }