New Input System integration

This thread is OBSOLETE!
There is now an official integration.

Link to the documentation



This post shows the setup how to integrate Unitys NewInputSystem and UCC.

Setup:
1. Install the InputSystem from the PackageManager and enable the new input backends. (Requires restart of the editor)

2. Download the integration package attached to this post.

3. Add the NewUnityInput script to your player. (Also, remove the UnityInput script from your player)
4. Add the PlayerInput script to your player.

3.PNG

5. Put the UCCInput.inputactions in the Actions field on the PlayerInput script. (See picture above)

6. You have to make minimal changes to Opsives Playerinput script. (See picture below)

4.PNG

7. Hit the "Replace with InputSystemUIInputModule" button on the StandaloneInputModule located on the EventSystem gameobject.



!Opsives Demo.scene will not work out of the box since it uses code from the old input system in quite a few demo specific scripts!


This integration works with keyboard and mouse and it should also work with modern controller (I dont have access to a controller right now, would be great if someone could test it).
Mobile input requires additional setup and is currently not working.

Additional sources to get started wit the NewInputSystem:
Meet the Devs: Input System - Unite Now (YouTube)
 

Attachments

  • UCCNewInputSystem.unitypackage
    6.2 KB · Views: 70
Last edited:
Whoa, this is awesome! Thank you for posting it!

Do you mind if I integrate it in one of the next updates?
 
Do you mind if I integrate it in one of the next updates?
No, I don´t mind :)

If you get into it, could you test if controllers are working? I don´t know if i use the correct bindings for controllers. (I would test it myself but I dont have access to a controller right now)
 
I have just updated the file UCCNewInputSystem.unitypackage in the original post.

Update:
  • Made sure that controller input is working (tested with xbox 360 controller)
  • Added processor "Axis Deadzone" to left/right stick bindings
    • Before you just had to touch the sticks to give input. Now you actually need to push the sticks.
  • Added processor "Scale" to right stick binding
    • The controller sensitivity was very low compared to mouse sensitivity.
inputactions.PNG
 
If I try add UnityEngine.InputSystem... to the Opsive PlayerInput script, I have got namespace missing error. I've tried in a new script and there is work well and script can see the namespace.
 
I believe it has something to do with Assembly Definitions.
To fix your problem you can add the Assembly Definition "Unity.InputSystem" directly to the character controllers import settings.
The file is called "Opsive.UltimateCharacterController.asmdef" and is located under:
Opsive>UltimateCharacterController>Scripts


OpsiveImportSettings.PNG
 
Wow thanks you so much! I just got UCC and bumped out to find that it using the old Input Manager. You just saved me lots of time.
 
In combination with the Adventure Camera, the camera control does not work correctly.
Can you be more specific? What exactly isn´t working correctly?

I haven´t tested it with the newest version (2.2.4) ... but I don´t think that they have changed anything regarding viewtypes.
 
I tested under the latest version 2.2.4 and unity 2019.4.3.f1 tried to re-import everything and also the InputSystem 1.0.0.0 unfortunately the change did not work to reproduce it. The behavior is that the camera is fixed behind the character and could not be rotated in adventure viewtype and adventure movement types.
 
I made an account just to say thank you for this, it works perfectly and as to the above comments, I am using the third person adventure character mode, and it seems to be working fine for me, so I am unable to help in that regard, sorry.
I hope this is added as an option in the base package.
Thanks again! :)
 
I tested under the latest version 2.2.4 and unity 2019.4.3.f1 tried to re-import everything and also the InputSystem 1.0.0.0 unfortunately the change did not work to reproduce it. The behavior is that the camera is fixed behind the character and could not be rotated in adventure viewtype and adventure movement types.

The error in my case was due to the fact that both input components were on the player, the old deactivated PlayerInput was returned in CameraControllerHandler.

Workaround: ;-)
m_PlayerInput = (from input in character.GetComponents <PlayerInput> ()
where input.enabled
select input).First();
 
Using UCC in 3rd person I have followed instructions on using new Input System Package including the EventSystem swap with Input System UI Input Module. All seems to work fine but for a console message warning:

Error: The character Cat_RM has no UnityInput component.
UnityEngine.Debug:LogError (object)
Opsive.UltimateCharacterController.Input.VirtualControls.VirtualControlsManager:OnAttachCharacter (UnityEngine.GameObject) (at Assets/Opsive/UltimateCharacterController/Scripts/Input/VirtualControls/VirtualControlsManager.cs:73)

Debugging the code i see in VirtualControlManager.cs where the problem is:

var activateGameObject = false;
if (character != null) {
var unityInput = m_Character.GetComponent<UnityInput>();
if (unityInput == null) {
Debug.LogError($"Error: The character {m_Character.name} has no UnityInput component.");
m_GameObject.SetActive(false);
return;
}

// If the virtual controls weren't registered then the virtual input type isn't selected.
activateGameObject = unityInput.RegisterVirtualControlsManager(this);
}

we are checking for the old Input Module anyway so we get the message

of course it is easy to correct it with a workaround in code (like commenting the Debug.LogError) , but I believe it should be reported in instructions until fixed by Opsive.
 
Last edited:
The virtual controls require the old Input Manager system - the new Unity Input System doesn't have the RegisterVirtualControls method so that's what you are getting the error. I can look at adding support for the new Unity Input System and the virtual controls.
 
The virtual controls require the old Input Manager system - the new Unity Input System doesn't have the RegisterVirtualControls method so that's what you are getting the error. I can look at adding support for the new Unity Input System and the virtual controls.
Is there any update for this?
 
I haven't used it but the new input system includes its own virtual controls so you do not need to use the ones designed for the old input manager.
 
Top