Gelatinous3
New member
Hoping someone can help me solve this:
I'm attempting to remap the functions of 'Enable Cursor with Escape' from UnityInput to LeftAlt (as well as the keybindings to open any relevant UIS panels requiring mouse input), while simultaneously disabling camera and character movement when the mouse cursor is enabled.
On manipulating the Enable Cursor with Escape function, I am able to successfully remap the cursor display to LeftAlt, however the function to disable the cursor display and return to gameplay is not working. My code is as follows:
Additionally, the 'OnEnableGameplayInput' functions are not achieving the desired results (nor is 'EnableGameplayInput' which I tried to call directly from the UnityInput script, hence it being commented out atm). I've locked the camera via these lines on the rotate/move functions in the CameraController.cs script which works fine, but does not prevent player movement.
Currently using Third Person Adventure camera and movement presets, in case that matters - though I couldn't find anything in either of those scrips that would be interfering.
I'm attempting to remap the functions of 'Enable Cursor with Escape' from UnityInput to LeftAlt (as well as the keybindings to open any relevant UIS panels requiring mouse input), while simultaneously disabling camera and character movement when the mouse cursor is enabled.
On manipulating the Enable Cursor with Escape function, I am able to successfully remap the cursor display to LeftAlt, however the function to disable the cursor display and return to gameplay is not working. My code is as follows:
Code:
if (m_EnableCursorWithEscape && UnityEngine.Input.GetKeyDown(KeyCode.LeftAlt)) {
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
EventHandler.ExecuteEvent(m_Character, "OnEnableGameplayInput", false);
// EnableGameplayInput(false);
if (m_PreventLookVectorChanges) {
OnApplicationFocus(false);
}
} else if (Cursor.visible && m_DisableCursor && !IsPointerOverUI() && (UnityEngine.Input.GetKeyDown(KeyCode.Mouse0) || UnityEngine.Input.GetKeyDown(KeyCode.Mouse1))) {
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
EventHandler.ExecuteEvent(m_Character, "OnEnableGameplayInput", true);
// EnableGameplayInput(false);
if (m_PreventLookVectorChanges) {
OnApplicationFocus(true);
}
Additionally, the 'OnEnableGameplayInput' functions are not achieving the desired results (nor is 'EnableGameplayInput' which I tried to call directly from the UnityInput script, hence it being commented out atm). I've locked the camera via these lines on the rotate/move functions in the CameraController.cs script which works fine, but does not prevent player movement.
Code:
if (Cursor.visible == true)
{
return;
}
Currently using Third Person Adventure camera and movement presets, in case that matters - though I couldn't find anything in either of those scrips that would be interfering.