#1 시작할 때, Key Action이 전부 활성화되는 버그 수정

- 1.7.0 Input System에서는 문제 없다가 1.8.2로 업그레이드되면서 처음 PlayerInput의 모든 Action이 Enable되는 현상이 생겼습니다.
- CombatPlayer프리팹에서 PlayerInput컴포넌트를 비활성화 하고, 생성과 동시에 활성화합니다.
- 첫 번째 튜토리얼에 진입하는 순간, 키 입력을 순간적으로 비활성화하고 되돌립니다.

Closes #1
This commit is contained in:
Nam Tae Gun 2024-06-04 22:15:14 +09:00
parent 927cfab2fb
commit 7f021541d6
7 changed files with 44 additions and 15 deletions

View File

@ -4929,6 +4929,10 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 522031830802304584, guid: 680ce017bd2b7d34a99245242d032120, type: 3}
propertyPath: _waitDuration
value: 1
objectReference: {fileID: 0}
- target: {fileID: 668700138157159316, guid: 680ce017bd2b7d34a99245242d032120, type: 3} - target: {fileID: 668700138157159316, guid: 680ce017bd2b7d34a99245242d032120, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: -5 value: -5

View File

@ -27,6 +27,7 @@ namespace BlueWater.Players.Combat
public void InitializeComponents(PlayerInput playerInput) public void InitializeComponents(PlayerInput playerInput)
{ {
_playerInput = playerInput; _playerInput = playerInput;
_playerInput.enabled = true;
PlayerInputKeyManager.Instance.SetCurrentPlayerInput(_playerInput); PlayerInputKeyManager.Instance.SetCurrentPlayerInput(_playerInput);
PlayerInputKeyManager.Instance.SwitchCurrentActionMap(InputActionMaps.Combat); PlayerInputKeyManager.Instance.SwitchCurrentActionMap(InputActionMaps.Combat);
} }

View File

@ -60,6 +60,7 @@ namespace BlueWater.Players.Combat
private void Awake() private void Awake()
{ {
InitializeComponents(); InitializeComponents();
InitializeChileComponents();
} }
private void Start() private void Start()
@ -95,7 +96,10 @@ namespace BlueWater.Players.Combat
PlayerHealthPoint = GetComponent<PlayerHealthPoint>(); PlayerHealthPoint = GetComponent<PlayerHealthPoint>();
CombatSkillController = GetComponent<CombatSkillController>(); CombatSkillController = GetComponent<CombatSkillController>();
CombatStatus = GetComponent<CombatStatus>(); CombatStatus = GetComponent<CombatStatus>();
}
private void InitializeChileComponents()
{
CombatInput.InitializeComponents(PlayerInput); CombatInput.InitializeComponents(PlayerInput);
CombatMovement.InitializeComponents(Rigidbody, VisualLook, AnimationController); CombatMovement.InitializeComponents(Rigidbody, VisualLook, AnimationController);
AnimationController.InitializeComponents(Animator); AnimationController.InitializeComponents(Animator);

View File

@ -83,6 +83,16 @@ namespace BlueWater
_currentPlayerInput.enabled = false; _currentPlayerInput.enabled = false;
} }
public void DisableAllActionMaps()
{
if (IsNullCurrentPlayerInput()) return;
foreach (var element in _currentPlayerInput.actions.actionMaps)
{
element.Disable();
}
}
public void DisableAllActionsExcept(string exceptActionName) public void DisableAllActionsExcept(string exceptActionName)
{ {
if (IsNullCurrentPlayerInput()) return; if (IsNullCurrentPlayerInput()) return;

View File

@ -1,3 +1,4 @@
using System.Collections;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEngine; using UnityEngine;
@ -30,13 +31,21 @@ namespace BlueWater.Uis
public void ShowFirstTutorialUi() public void ShowFirstTutorialUi()
{ {
PlayerInputKeyManager.Instance.SwitchCurrentActionMap(InputActionMaps.CombatUi); PlayerInputKeyManager.Instance.DisableCurrentPlayerInput();
PlayerInputKeyManager.Instance.DisableAllActionsExcept("InteractionUi");
gameObject.SetActive(true); gameObject.SetActive(true);
_firstTutorialUi.SetActive(true); _firstTutorialUi.SetActive(true);
_secondTutorialUi.SetActive(false); _secondTutorialUi.SetActive(false);
CurrentTutorialState = TutorialState.First; CurrentTutorialState = TutorialState.First;
StartCoroutine(FirstTutorialCoroutine());
}
private IEnumerator FirstTutorialCoroutine()
{
yield return new WaitForSeconds(0.1f);
PlayerInputKeyManager.Instance.EnableCurrentPlayerInput();
PlayerInputKeyManager.Instance.SwitchCurrentActionMap(InputActionMaps.CombatUi);
PlayerInputKeyManager.Instance.DisableAllActionsExcept("InteractionUi");
} }
public void SecondFirstTutorialUi() public void SecondFirstTutorialUi()

View File

@ -155,7 +155,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6290149650087484560} m_GameObject: {fileID: 6290149650087484560}
m_Enabled: 1 m_Enabled: 0
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3}
m_Name: m_Name:

View File

@ -1,7 +1,14 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c62a00534346f6d40bee94a846773d83 guid: c62a00534346f6d40bee94a846773d83
AssetOrigin:
serializedVersion: 1
productId: 271742
packageName: 'COZY: Stylized Weather 3'
packageVersion: 3.4.1
assetPath: Packages/com.distantlands.cozy.core/Content/Demo/Mesh/Observatory.fbx
uploadId: 665941
ModelImporter: ModelImporter:
serializedVersion: 21300 serializedVersion: 22200
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: externalObjects:
- first: - first:
@ -56,8 +63,6 @@ ModelImporter:
optimizeGameObjects: 0 optimizeGameObjects: 0
removeConstantScaleCurves: 1 removeConstantScaleCurves: 1
motionNodeName: motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors: animationImportErrors:
animationImportWarnings: animationImportWarnings:
animationRetargetingWarnings: animationRetargetingWarnings:
@ -80,6 +85,7 @@ ModelImporter:
addColliders: 0 addColliders: 0
useSRGBMaterialColor: 1 useSRGBMaterialColor: 1
sortHierarchyByName: 1 sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1 importVisibility: 1
importBlendShapes: 1 importBlendShapes: 1
importCameras: 1 importCameras: 1
@ -107,6 +113,7 @@ ModelImporter:
secondaryUVMinObjectScale: 1 secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4 secondaryUVPackMargin: 4
useFileScale: 0 useFileScale: 0
strictVertexDataChecks: 0
tangentSpace: tangentSpace:
normalSmoothAngle: 60 normalSmoothAngle: 60
normalImportMode: 0 normalImportMode: 0
@ -139,15 +146,9 @@ ModelImporter:
humanoidOversampling: 1 humanoidOversampling: 1
avatarSetup: 0 avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1 addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 0
remapMaterialsIfMaterialImportModeIsNone: 0 remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0 additionalBone: 0
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 271742
packageName: 'COZY: Stylized Weather 3'
packageVersion: 3.4.1
assetPath: Packages/com.distantlands.cozy.core/Content/Demo/Mesh/Observatory.fbx
uploadId: 665941