New Input System is a MESS

Spent the last 20 minutes just trying to get a mouse click to activate change one bool.
Still doesnt work.

The new input system is garbage if it cannot produce a simple mousedown without 10 hours of work. This is NOT helpful.

Creating new input controls, and then mapping, and then registering functions, and then enabling/disabling

How is this supposed to be helpful? It lacks basic simple function passthru. What a burden.

You can still do it in the update if you want

Same, i wanted to change my current Inputs (Input.Get…etc) with the new System but its really a big Mess.

Any use of the old input system causes conflict.
Can you be more specific in how you are implementing this?

Spent the last 20 minutes writing this script.

From the above script:

		// click mouse button
		// Input.GetMouseButtonDown(0)
		if (Mouse.current.leftButton.wasPressedThisFrame)
		{
			// mouse position
			Vector2 position = Mouse.current.position.value;

			Debug.Log("Click mouse Button 0: " + Time.time + " at " + position);
		}

Its supposed to be useful for cross platform development, but honestly it was so frustrating to work with, I cant even write controls to start my player. I have went back to a KB layout for now, but its still waay too time consuming for basic function that I had day 1 with Unity 3.

An absolute handicap for small implementation.

If you don’t want to have conflicts or be sure to use only the new input system you can disable the old one in the player settings

I know :’ (

I would prefer not to reimport depreciated libraries. Lord knows thats a ticking time bomb for namespace conflicts in the future, among other things.

I appreciate the work around though.

I have it working with keyboard, but now its ignoring my mouse clicks. oh well. kb dev it is for now. moving on : )

Unfortunately I do ultimately need the new system, as this will be a mobile release as well. sigh

You really want to isolate ALL input to the tiniest piece of code possible, ideally one function called GatherInput(); that writes all relevant input to temporary variables.

Then 100% of your code operates on those temporary variables.

Someday when Unity comes out with the NEW NEW NEW Input System, you change that one function and you’re done.

Otherwise it will be a nightmare of chasing code around your entire project. Don’t live like that.

Yes, there’s more considerations for something like UGUI, but that’s almost always handled properly by swapping out the StandardInputModule when you install New Input System.

First of all i will suggest you to create the function for the input action, for example create a function called “Jump” with this parameter “InputAction.CallbackContext context”


Than go to the Project wise action and set them there

Then you can add a PlayerInput component to the object with the Jump action script set, set the Behaviour to Invoke Unity events and link the Jump function to the player inputs events.

This is the easiest way to start with the new input system, the Player input rappresent one player and it’s a componenet that helps you getting started, but you can use it if you don’t have any specific game logic

Try this.

using UnityEngine;
using UnityEngine.InputSystem;

namespace XXXXXXX.NewInputSystemWrapper
{
    /// <summary>
    /// A dispatcher that bridges new Input System events (from both mouse and touch) into our custom event interfaces.
    /// </summary>
    public class CustomInputDispatcher : MonoBehaviour
    {
        // Mouse input actions.
        private InputAction mousePress;
        private InputAction mousePosition;
        // Touch input actions (using primary touch).
        private InputAction touchPress;
        private InputAction touchPosition;

        private bool isDragging = false;
        private GameObject currentTarget = null;
        private Vector2 pointerDownPosition;

        private void Awake()
        {
            // Create mouse actions.
            mousePress = new InputAction(type: InputActionType.Button, binding: "<Mouse>/leftButton");
            mousePosition = new InputAction(type: InputActionType.PassThrough, binding: "<Mouse>/position");

            // Create touch actions (using primary touch).
            touchPress = new InputAction(type: InputActionType.Button, binding: "<Touchscreen>/primaryTouch/press");
            touchPosition = new InputAction(type: InputActionType.PassThrough, binding: "<Touchscreen>/primaryTouch/position");

            // Subscribe to mouse events.
            mousePress.started += ctx => ProcessDown(mousePosition.ReadValue<Vector2>());
            mousePress.canceled += ctx => ProcessUp(mousePosition.ReadValue<Vector2>());
            mousePosition.performed += ctx => ProcessMove(mousePosition.ReadValue<Vector2>());

            // Subscribe to touch events.
            touchPress.started += ctx => ProcessDown(touchPosition.ReadValue<Vector2>());
            touchPress.canceled += ctx => ProcessUp(touchPosition.ReadValue<Vector2>());
            touchPosition.performed += ctx => ProcessMove(touchPosition.ReadValue<Vector2>());
        }

        private void OnEnable()
        {
            mousePress.Enable();
            mousePosition.Enable();
            touchPress.Enable();
            touchPosition.Enable();
        }

        private void OnDisable()
        {
            mousePress.Disable();
            mousePosition.Disable();
            touchPress.Disable();
            touchPosition.Disable();
        }

        /// <summary>
        /// Called when either a mouse or touch press begins.
        /// </summary>
        /// <param name="position">The screen position of the pointer/touch.</param>
        private void ProcessDown(Vector2 position)
        {

        }

        /// <summary>
        /// Called when either a mouse or touch movement occurs.
        /// </summary>
        /// <param name="position">The current screen position of the pointer/touch.</param>
        private void ProcessMove(Vector2 position)
        {

        }

        /// <summary>
        /// Called when either a mouse or touch press is released.
        /// </summary>
        /// <param name="position">The screen position of the pointer/touch upon release.</param>
        private void ProcessUp(Vector2 position)
        {

        }
    }
}

This is a common theme I see folks expressing frustration with. Unity should really tackle this head on with content on how to simplify setting things like this up. I hear good things about Rewired as an alternative.

A skinnable prefab for input rebinding would be awesome and realistically cover most use cases.

I remember not liking it but it’s also been a long time since I tried it.

To be honest the docs cover pretty clearly how to get up and running: Quickstart Guide | Input System | 1.13.1

There’s plenty of other ways to read input via the system, some more suited to certain use cases for other, all covered in the docs.

The only issue I see really is not reading the manual.

Maybe you should keep your snide opinions to yourself.

It’s not really an opinion, but constructive criticism. If you’ve spent 10 hours with something that’s clearly covered in the first few pages of the docs, then you should take on onboard the age old advice: RTFM.

Crikey mate all I suggested was to read the manual, and you respond with personal insults.

Have fun struggling with other basic Unity stuff I guess, if that’s your attitude.

Naw. What you actually did was rubber stamp my post in your brain, as someone in need of your benevolent ‘help.’

I don’t need your help bro. When are you going to get that?

I never asked for help.

You offered help I didn’t need, and on to of that
Told me to ‘read the f***ing manual’

Then insulted my programming skills.

What EXACTLY help are you offering me?

Like I said, maybe you could comprehend before you go playing up how great you are.

You escalated, and now I’m finishing it.

Good bye. And learn to take good bye as an answer this time kid.

EDIT: My post is fine. Take it down. Apparently speaking my opinion is spam, and i have to let people insult me in some kind of double standard.

Just so all of you know, I didnt ask for any help. Read the actual topic next time, and maybe grow up from kicking the can of your collective ignorance down the road?

Cheers.

Was looking for something higher level than just calling devices by their root access.
Cumbersome, to say the least.
Thankfully this game is not control intensive, hence my frustration.

I appreciate the considered feedback.