fix: Null Reference Error on ITransform.SetParent
This commit is contained in:
parent
d9660c08b1
commit
ed6975bf24
|
@ -127,13 +127,13 @@ public class Transform : ITransform
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ITransform? previousParent = Parent;
|
ITransform? previousParent = Parent;
|
||||||
if (Parent is not null)
|
if (previousParent is not null)
|
||||||
{
|
{
|
||||||
Parent.RemoveChild(this);
|
previousParent.RemoveChild(this);
|
||||||
Parent.OnPositionChanged -= RecalculatePosition;
|
previousParent.OnPositionChanged -= RecalculatePosition;
|
||||||
Parent.OnScaleChanged -= RecalculateScale;
|
previousParent.OnScaleChanged -= RecalculateScale;
|
||||||
Parent.OnRotationChanged -= RecalculateRotation;
|
previousParent.OnRotationChanged -= RecalculateRotation;
|
||||||
Parent.OnParentChanged -= NotifyChildrenOnParentChange;
|
previousParent.OnParentChanged -= NotifyChildrenOnParentChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
Parent = transform;
|
Parent = transform;
|
||||||
|
|
Loading…
Reference in New Issue