refactor: Improved & Fixed Issues with Transforms with Parents
This commit is contained in:
@@ -140,6 +140,9 @@ public class GameManager : BaseEntity, IGameManager
|
||||
gameObject.OnFinalized += OnGameObjectFinalize;
|
||||
gameObject.OnExitedHierarchy += OnGameObjectExitedHierarchy;
|
||||
|
||||
foreach (ITransform child in gameObject.Transform.Children)
|
||||
Register(child.GameObject);
|
||||
|
||||
if (!gameObject.Initialize())
|
||||
throw new Exception($"{nameof(gameObject)} can't be initialized");
|
||||
|
||||
@@ -161,6 +164,9 @@ public class GameManager : BaseEntity, IGameManager
|
||||
gameObject.OnFinalized -= OnGameObjectFinalize;
|
||||
gameObject.OnExitedHierarchy -= OnGameObjectExitedHierarchy;
|
||||
|
||||
foreach (ITransform child in gameObject.Transform.Children)
|
||||
Unregister(child.GameObject);
|
||||
|
||||
_gameObjects.Remove(gameObject);
|
||||
_hierarchyObjects.Remove(gameObject);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user