[BUG] PlayerInput.cs still requires old input system when switching to new one

ChristianWiele

Active member
Hi,

I switched to the new input system, but the abstract class PlayerInput throws an exception at line 322 as it still requires the old input system to be active. As a work around I activated both systems in the player settings.
 
The new input returns false for CanCheckForController, so the code one line 328 should never run.
 
That might be the reason. In UnityInputSystem.cs you have a line

protected override bool CanCheckForController => false;

But I get a "no suitable method ..." error, as there is no CanChekForController method in the base class.

The method in the base class PlayerInput is called CheckForController and is private.

I removed the override to get rid of the error.
 
That doesn't sound like you are running the latest version. In version 2.2.5 there is now a CanCheckForController property that UnityInputSystem overrides.
 
Also worth noting, from the documentation I linked for the integration:
The demo scene included with the character controller will not work with this integration as the Demo scene scripts use the old Input Manager system.
So after setting up the integration, there will still be a few errors when you try to run the demo scene.
 
Sorry, seems something went wrong during the import of the new version. I imported it again, and now everything's fine. Thanks for the quick response.
 
In Unity 2019.4.9f1 I'm using 1.0.0 of the new input system and Nolan with 3rd person demo controller. Setup a basic scene with just a plane and character and I get the same error as listed above using 2.2.5. I followed the instructions as per @Andrew's link.

When commenting out that line, I get

Code:
InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
Opsive.UltimateCharacterController.Input.PlayerInput.CheckForController () (at Assets/Opsive/UltimateCharacterController/Scripts/Input/PlayerInput.cs:322)
Opsive.UltimateCharacterController.Input.PlayerInput.OnApplicationFocus (System.Boolean hasFocus) (at Assets/Opsive/UltimateCharacterController/Scripts/Input/PlayerInput.cs:485)
Opsive.UltimateCharacterController.Input.UnityInputSystem.OnApplicationFocus (System.Boolean hasFocus) (at Assets/Opsive/UltimateCharacterController/Integrations/InputSystem/UnityInputSystem.cs:191)

InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
Opsive.UltimateCharacterController.Input.PlayerInput.CheckForController () (at Assets/Opsive/UltimateCharacterController/Scripts/Input/PlayerInput.cs:322)
Opsive.UltimateCharacterController.Input.PlayerInput.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Input/PlayerInput.cs:113)
Opsive.UltimateCharacterController.Input.UnityInputSystem.Awake () (at Assets/Opsive/UltimateCharacterController/Integrations/InputSystem/UnityInputSystem.cs:48)

As far as I can tell, I've removed the original Unity Input - I can't se where thats coming from.
 
Last edited:
It doesn't look like you have fully updated to version 2.2.5. UnityInputSystem returns false on line 324 of PlayerInput for if it should check for the controller.
 
Top