I’m working on developing my first game, and I am currently in the process of setting up the new Input System for game controller input. I got most everything working, but for some reason about halfway through the setup process, Unity play mode stopped responding to the right game stick for rotation control - even though I left that as default and didn’t assign any of my customized actions to that stick…
I tested my game controller on my downloaded copy of Halo, and confirmed the right stick is working fine there, so it appears to be something I did (unintentionally) in Unity, but I’m not sure what it was I did, so also don’t know how to undo it.
Here’s a screenshot of my PlayerControls setup:
I also checked the PlayerControls.cs script, but not entirely sure what I’m looking for in there:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.5.1
// from Assets/Scripts/FPController/PlayerControls.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public partial class @PlayerControls: IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @PlayerControls()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""PlayerControls"",
""maps"": [
{
""name"": ""Gameplay"",
""id"": ""89feef98-2328-4038-9c0e-21724f5323ed"",
""actions"": [
{
""name"": ""Sprint"",
""type"": ""Button"",
""id"": ""ac2237a1-e675-4013-ad63-5c05196aeec4"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""NoClip"",
""type"": ""Button"",
""id"": ""10e0d30d-abf5-41b7-84c7-53194b48eac5"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Prev"",
""type"": ""Button"",
""id"": ""3278f662-3692-4f1d-bd1a-484619a06141"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Next"",
""type"": ""Button"",
""id"": ""03265929-9b4a-499f-84e8-9aa6cab1d5f8"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Map"",
""type"": ""Button"",
""id"": ""9dae1aa5-5c6b-40ad-aa41-a464d362b7ab"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Debugger"",
""type"": ""Button"",
""id"": ""dde0a72b-f84a-4804-b3fd-a53831b53a5d"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Pause"",
""type"": ""Button"",
""id"": ""6b0a72d3-ad26-42a6-ab53-706ccb6b6f16"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""SwitchWeapon"",
""type"": ""Button"",
""id"": ""6a2c57cc-e218-4296-8e7b-b51ed5d1033c"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
{
""name"": """",
""id"": ""31789226-026c-4999-bb7e-f31f9757394c"",
""path"": ""<Gamepad>/leftTrigger"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Sprint"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""80251c0b-7f3e-4d07-a441-d4afcbbde344"",
""path"": ""<Gamepad>/rightTrigger"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""NoClip"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""c3f252ec-40ba-4c4c-985e-d524676fccbf"",
""path"": ""<Gamepad>/leftShoulder"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Prev"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""5088d7ec-2207-417d-8e4e-3df0cc599b3d"",
""path"": ""<Gamepad>/rightShoulder"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Next"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""430b95ef-bfdc-41af-93dc-13fe661e8846"",
""path"": ""<Gamepad>/buttonNorth"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Map"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""0a249899-d5ab-4c94-a019-6e1fdc382fc2"",
""path"": ""<Gamepad>/rightShoulder"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Debugger"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""a1c50e59-a247-4858-b013-56230481cec6"",
""path"": ""<Gamepad>/start"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Pause"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""1cb0ad73-8f17-461f-8daa-b0f4466e3cae"",
""path"": ""<Gamepad>/buttonEast"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""SwitchWeapon"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": []
}");
// Gameplay
m_Gameplay = asset.FindActionMap("Gameplay", throwIfNotFound: true);
m_Gameplay_Sprint = m_Gameplay.FindAction("Sprint", throwIfNotFound: true);
m_Gameplay_NoClip = m_Gameplay.FindAction("NoClip", throwIfNotFound: true);
m_Gameplay_Prev = m_Gameplay.FindAction("Prev", throwIfNotFound: true);
m_Gameplay_Next = m_Gameplay.FindAction("Next", throwIfNotFound: true);
m_Gameplay_Map = m_Gameplay.FindAction("Map", throwIfNotFound: true);
m_Gameplay_Debugger = m_Gameplay.FindAction("Debugger", throwIfNotFound: true);
m_Gameplay_Pause = m_Gameplay.FindAction("Pause", throwIfNotFound: true);
m_Gameplay_SwitchWeapon = m_Gameplay.FindAction("SwitchWeapon", throwIfNotFound: true);
}
public void Dispose()
{
UnityEngine.Object.Destroy(asset);
}
public InputBinding? bindingMask
{
get => asset.bindingMask;
set => asset.bindingMask = value;
}
public ReadOnlyArray<InputDevice>? devices
{
get => asset.devices;
set => asset.devices = value;
}
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
public bool Contains(InputAction action)
{
return asset.Contains(action);
}
public IEnumerator<InputAction> GetEnumerator()
{
return asset.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Enable()
{
asset.Enable();
}
public void Disable()
{
asset.Disable();
}
public IEnumerable<InputBinding> bindings => asset.bindings;
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
{
return asset.FindAction(actionNameOrId, throwIfNotFound);
}
public int FindBinding(InputBinding bindingMask, out InputAction action)
{
return asset.FindBinding(bindingMask, out action);
}
// Gameplay
private readonly InputActionMap m_Gameplay;
private List<IGameplayActions> m_GameplayActionsCallbackInterfaces = new List<IGameplayActions>();
private readonly InputAction m_Gameplay_Sprint;
private readonly InputAction m_Gameplay_NoClip;
private readonly InputAction m_Gameplay_Prev;
private readonly InputAction m_Gameplay_Next;
private readonly InputAction m_Gameplay_Map;
private readonly InputAction m_Gameplay_Debugger;
private readonly InputAction m_Gameplay_Pause;
private readonly InputAction m_Gameplay_SwitchWeapon;
public struct GameplayActions
{
private @PlayerControls m_Wrapper;
public GameplayActions(@PlayerControls wrapper) { m_Wrapper = wrapper; }
public InputAction @Sprint => m_Wrapper.m_Gameplay_Sprint;
public InputAction @NoClip => m_Wrapper.m_Gameplay_NoClip;
public InputAction @Prev => m_Wrapper.m_Gameplay_Prev;
public InputAction @Next => m_Wrapper.m_Gameplay_Next;
public InputAction @Map => m_Wrapper.m_Gameplay_Map;
public InputAction @Debugger => m_Wrapper.m_Gameplay_Debugger;
public InputAction @Pause => m_Wrapper.m_Gameplay_Pause;
public InputAction @SwitchWeapon => m_Wrapper.m_Gameplay_SwitchWeapon;
public InputActionMap Get() { return m_Wrapper.m_Gameplay; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(GameplayActions set) { return set.Get(); }
public void AddCallbacks(IGameplayActions instance)
{
if (instance == null || m_Wrapper.m_GameplayActionsCallbackInterfaces.Contains(instance)) return;
m_Wrapper.m_GameplayActionsCallbackInterfaces.Add(instance);
@Sprint.started += instance.OnSprint;
@Sprint.performed += instance.OnSprint;
@Sprint.canceled += instance.OnSprint;
@NoClip.started += instance.OnNoClip;
@NoClip.performed += instance.OnNoClip;
@NoClip.canceled += instance.OnNoClip;
@Prev.started += instance.OnPrev;
@Prev.performed += instance.OnPrev;
@Prev.canceled += instance.OnPrev;
@Next.started += instance.OnNext;
@Next.performed += instance.OnNext;
@Next.canceled += instance.OnNext;
@Map.started += instance.OnMap;
@Map.performed += instance.OnMap;
@Map.canceled += instance.OnMap;
@Debugger.started += instance.OnDebugger;
@Debugger.performed += instance.OnDebugger;
@Debugger.canceled += instance.OnDebugger;
@Pause.started += instance.OnPause;
@Pause.performed += instance.OnPause;
@Pause.canceled += instance.OnPause;
@SwitchWeapon.started += instance.OnSwitchWeapon;
@SwitchWeapon.performed += instance.OnSwitchWeapon;
@SwitchWeapon.canceled += instance.OnSwitchWeapon;
}
private void UnregisterCallbacks(IGameplayActions instance)
{
@Sprint.started -= instance.OnSprint;
@Sprint.performed -= instance.OnSprint;
@Sprint.canceled -= instance.OnSprint;
@NoClip.started -= instance.OnNoClip;
@NoClip.performed -= instance.OnNoClip;
@NoClip.canceled -= instance.OnNoClip;
@Prev.started -= instance.OnPrev;
@Prev.performed -= instance.OnPrev;
@Prev.canceled -= instance.OnPrev;
@Next.started -= instance.OnNext;
@Next.performed -= instance.OnNext;
@Next.canceled -= instance.OnNext;
@Map.started -= instance.OnMap;
@Map.performed -= instance.OnMap;
@Map.canceled -= instance.OnMap;
@Debugger.started -= instance.OnDebugger;
@Debugger.performed -= instance.OnDebugger;
@Debugger.canceled -= instance.OnDebugger;
@Pause.started -= instance.OnPause;
@Pause.performed -= instance.OnPause;
@Pause.canceled -= instance.OnPause;
@SwitchWeapon.started -= instance.OnSwitchWeapon;
@SwitchWeapon.performed -= instance.OnSwitchWeapon;
@SwitchWeapon.canceled -= instance.OnSwitchWeapon;
}
public void RemoveCallbacks(IGameplayActions instance)
{
if (m_Wrapper.m_GameplayActionsCallbackInterfaces.Remove(instance))
UnregisterCallbacks(instance);
}
public void SetCallbacks(IGameplayActions instance)
{
foreach (var item in m_Wrapper.m_GameplayActionsCallbackInterfaces)
UnregisterCallbacks(item);
m_Wrapper.m_GameplayActionsCallbackInterfaces.Clear();
AddCallbacks(instance);
}
}
public GameplayActions @Gameplay => new GameplayActions(this);
public interface IGameplayActions
{
void OnSprint(InputAction.CallbackContext context);
void OnNoClip(InputAction.CallbackContext context);
void OnPrev(InputAction.CallbackContext context);
void OnNext(InputAction.CallbackContext context);
void OnMap(InputAction.CallbackContext context);
void OnDebugger(InputAction.CallbackContext context);
void OnPause(InputAction.CallbackContext context);
void OnSwitchWeapon(InputAction.CallbackContext context);
}
}
Any ideas as to what I did wrong would be greatly appreciated!