摄像机区域的架构改动
This commit is contained in:
33
Assets/_Game/Scripts/Input/InputReaderBootstrap.cs
Normal file
33
Assets/_Game/Scripts/Input/InputReaderBootstrap.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BaseGames.Input
|
||||
{
|
||||
/// <summary>
|
||||
/// 在运行时启用 InputReaderSO 的 ActionMap。
|
||||
/// 挂在 Persistent 场景的 InputReaderHolder 上。
|
||||
/// _inputReader 必须在 Inspector 中赋值,框架不提供运行时自动查找回退。
|
||||
/// </summary>
|
||||
public sealed class InputReaderBootstrap : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private InputReaderSO _inputReader;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Debug.Assert(_inputReader != null,
|
||||
"[InputReaderBootstrap] _inputReader 未在 Inspector 中赋值!请在 Persistent 场景的 InputReaderHolder 上手动指定 InputReaderSO 资产。",
|
||||
this);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (_inputReader == null) return;
|
||||
_inputReader.LoadBindingOverrides(); // 从 PlayerPrefs 恢复用户自定义绑定
|
||||
_inputReader.EnableGameplayInput();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
_inputReader?.DisableAllInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user