Search Unity

Why DefaultInputActions still work?

Discussion in 'Input System' started by drndfx, Dec 17, 2020.

  1. drndfx

    drndfx

    Joined:
    Jul 3, 2013
    Posts:
    89
    When you create a new custom Input Actions the EventSystem still has DefaultInputActions selected.

    In other words you don't seem to have to change it to be your Input Actions. And it works no matter what changes you make on your Input Actions. How is it possible?

    In what case do you have to drag and drop your input Actions?

    Please see attachment.
     

    Attached Files:

  2. Holonet

    Holonet

    Joined:
    Aug 14, 2017
    Posts:
    84
    The first thing to note is that you're only looking at the UI controls.

    Having your own input actions does not disable the default ones, and as you say, they are selected by default in the new input system. The default actions set up typical inputs for the various devices. You can drag and drop your own input actions in there, and they will work too (I forget, you might need to put actions under the "UI" map specifically, but either way...). Of course, those defaults will still work, on the UI anyway, as long as you have those actions in that slot.

    They would not work on say, a character, unless you drag the default actions into the PlayerInput component you add to that player...which you could if you wanted....

    Basically, it's up to you. You would have to drag and drop your own actions in if you wanted different things to trigger those actions, or you could edit it the default, I'm sure.
     
  3. drndfx

    drndfx

    Joined:
    Jul 3, 2013
    Posts:
    89
    Thank you.

    I have [Q] and [E] keys assigned on my scene through ManualActions in which DefaultActions doesn't have.
    How does Unity know I'm using [Q] and [E] keys if I didn't drag and drop my ManualActions into the "Action Assets" slot?

    I've seen many videos and tutorials and nobody seem to say we should replace the DefaultActions slot. Everyone just ignores that part.
     
  4. drndfx

    drndfx

    Joined:
    Jul 3, 2013
    Posts:
    89
    I think I found the answer each game object can accept different Inputs. By default the DefaultInput is being assigned on Event System.
     
  5. Holonet

    Holonet

    Joined:
    Aug 14, 2017
    Posts:
    84
    Yup, that's what I was saying about the PlayerInput component. If you put that on your player object, it will respond to whatever actions asset you drag into that. The EventSystem defaults to the provided actions, and that applies to the UI. You don't need to replace it, but you can.... and if you drag your own actions into a PlayerInput component on your player object, then the defaultactions won't matter there because the EventSystem, again, is for the UI behavior. The way Unity knows is simply which actions you apply to whatever you're doing.