public void ReplaceMe(GObject target)
{
if (parent == null)
throw new Exception("parent not set");
target.name = this.name;
target.alpha = this.alpha;
target.rotation = this.rotation;
target.visible = this.visible;
target.touchable = this.touchable;
target.grayed = this.grayed;
target.SetXY(this.x, this.y);
target.SetSize(this.width, this.height);
int index = parent.GetChildIndex(this);
parent.AddChildAt(target, index);
target.relations.CopyFrom(this.relations);
parent.RemoveChild(this, true);
}