fix: IHierarchyObject.SetParent not entering the object into the IGameManager hierarchy fixed
This commit is contained in:
parent
6f425776cc
commit
1ee07b41f8
@ -78,6 +78,7 @@ public class GameManager : BaseEntity, IGameManager
|
||||
Remove(child);
|
||||
|
||||
_hierarchyObjects.Remove(hierarchyObject);
|
||||
hierarchyObject.SetParent(null);
|
||||
|
||||
if (!hierarchyObject.ExitHierarchy())
|
||||
throw new Exception($"{hierarchyObject.Name} can't exit the hierarchy");
|
||||
|
@ -62,8 +62,9 @@ public class HierarchyObject : BaseEntity, IHierarchyObject
|
||||
if (!IsInHierarchy || _gameManager is not IGameManager gameManager)
|
||||
return false;
|
||||
|
||||
_gameManager = null!;
|
||||
OnExitingHierarchy(gameManager);
|
||||
_gameManager = null!;
|
||||
SetParent(null);
|
||||
OnExitedHierarchy?.Invoke(this, gameManager);
|
||||
return true;
|
||||
}
|
||||
@ -87,6 +88,9 @@ public class HierarchyObject : BaseEntity, IHierarchyObject
|
||||
|
||||
if (parent is not null)
|
||||
{
|
||||
if (parent.IsInHierarchy && !IsInHierarchy)
|
||||
parent.GameManager.Register(this);
|
||||
|
||||
parent.AddChild(this);
|
||||
parent.OnActiveChanged += OnParentActiveChanged;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user