diff --git a/Engine.Core/GameManager.cs b/Engine.Core/GameManager.cs index d83d95d..dbc7394 100644 --- a/Engine.Core/GameManager.cs +++ b/Engine.Core/GameManager.cs @@ -37,7 +37,20 @@ public class GameManager : IEntity public bool Initialized => _initialized; public IList GameObjects => _gameObjects; - public IStateEnable StateEnable { get { if (_stateEnable is null) Assign(new StateEnableFactory().Instantiate(this)); return _stateEnable; } } + public IStateEnable StateEnable + { + get + { + if (_stateEnable is null) + { + Assign(new StateEnableFactory().Instantiate(this)); + if (_stateEnable is null) + throw NotAssignedException.From(this, _stateEnable); + } + + return _stateEnable; + } + } public void RegisterGameObject(IGameObject gameObject) {