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;
|
||||
|
||||
ITransform? previousParent = Parent;
|
||||
if (Parent is not null)
|
||||
if (previousParent is not null)
|
||||
{
|
||||
Parent.RemoveChild(this);
|
||||
Parent.OnPositionChanged -= RecalculatePosition;
|
||||
Parent.OnScaleChanged -= RecalculateScale;
|
||||
Parent.OnRotationChanged -= RecalculateRotation;
|
||||
Parent.OnParentChanged -= NotifyChildrenOnParentChange;
|
||||
previousParent.RemoveChild(this);
|
||||
previousParent.OnPositionChanged -= RecalculatePosition;
|
||||
previousParent.OnScaleChanged -= RecalculateScale;
|
||||
previousParent.OnRotationChanged -= RecalculateRotation;
|
||||
previousParent.OnParentChanged -= NotifyChildrenOnParentChange;
|
||||
}
|
||||
|
||||
Parent = transform;
|
||||
|
|
Loading…
Reference in New Issue