유니티 버전 - 6000.0.37f1
목차
- 이전글
- 저장, 로드, 삭제
이전글
이전에 구현한 커스텀 컨트롤 바인딩을 이용하여 저장, 로드, 삭제하는 기능입니다
저장, 로드, 삭제
public void SaveRebinds()
{
string json = playerInput.actions.SaveBindingOverridesAsJson();
File.WriteAllText(filePath, json);
}
public void LoadRebinds()
{
string json = File.ReadAllText(filePath);
playerInput.actions.LoadBindingOverridesFromJson(json);
}
public void ResetRebinds() // 유효한 ActionsName 및 인덱스인지 확인 필요
{
playerInput.actions.RemoveAllBindingOverrides();
// 전체 초기화
playerInput.actions["ActionsName"].RemoveAllBindingOverrides();
// 특정 액션 초기화
playerInput.actions["ActionsName"].RemoveBindingOverride(1);
// 특정 액션의 1번째 바인딩 초기화
}
'코드 및 공부 > 입력 관리' 카테고리의 다른 글
Rebind한 키세팅 저장/초기화/되돌리기 (0) | 2025.03.18 |
---|---|
커스텀 컨트롤 바인딩 (InputSystem을 이용한 Rebinding system) (0) | 2025.02.25 |
화면 해상도 및 전체화면 여부 조절하기, Screen.SetResolution() (0) | 2025.02.04 |
방향키로 버튼간 이동(탐색) 하기, UI Navigation (0) | 2025.02.03 |
유니티 유용한 단축키 3가지 (0) | 2025.01.14 |