public void Update(ComponentizedEntity entity, IGameContext gameContext, IUpdateContext updateContext) { if (!string.IsNullOrWhiteSpace(UserInterfaceAssetName)) { if (_userInterfaceAssetRef == null || _userInterfaceControllerAsset != UserInterfaceAssetName) { _userInterfaceAssetRef = _assetManager.Get <UserInterfaceAsset>(UserInterfaceAssetName); _userInterfaceControllerAsset = UserInterfaceAssetName; } if (_userInterfaceAssetRef.IsReady && _userInterfaceAssetRef.Asset != _userInterfaceAsset) { if (_userInterfaceController != null) { _userInterfaceController.Enabled = false; } _userInterfaceAsset = _userInterfaceAssetRef.Asset; _userInterfaceController = _userInterfaceFactory.CreateUserInterfaceController(_userInterfaceAsset); _userInterfaceController.Enabled = true; // Register behaviours. foreach (var behaviour in _behaviourRegistration) { behaviour(_userInterfaceController); } } } if (_userInterfaceController != null) { _userInterfaceController.Update(gameContext, updateContext); } }