Page 1 of 1

DS + UCC + New Input System

Posted: Wed May 26, 2021 1:52 am
by nathanj
Hello,

I've only spent a few hours with this and just hoping for a silver bullet if anyone else has come across this. Don't bother starting up a new project to test, I'm sure I'll figure it out soon enough.

However, if anyone else has figured this out I would love to hear what you did.

I'm trying to set up a new project with UCC, the New Input System (I do not have the old one installed because I'd rather just get it working completely) and Dialogue System. I am using the default CharacterInput from the integration package - I did add Fire1 to test button press (discussed below).

I have the player set up fine and they are able to trigger a conversation fine. The problem is that when it comes to clicking on the button with the mouse there is no input passed through. The button doesn't change colour when selected, there is just no response. I did do a test and added a UIButtonkeyTrigger to the response button and set it to "Fire1" and then added "InputDeviceManager.RegisterInputAction("Fire1", controls.UI.Fire1);" to the RegisterMyControl script and that worked, the button press was sucessful and the conversation carried on.

So, basically, it's just mouse cursor that is not sending a message. I should add that on the UnityInputSystem component I have a State that enables the Cursor by setting "Disable Cursor"to false - like with the basic input system. Can anyone think of what I'm missing or doing wrong?

Image
Image
Image

And the RegisterMyControls script

Code: Select all

using UnityEngine;
using UnityEngine.InputSystem;
using PixelCrushers;

public class RegisterMyControls : MonoBehaviour // Add me to Dialogue Manager.
{
    protected static bool isRegistered = false;
    private bool didIRegister = false;
    private CharacterInput controls;

    void Awake()
    {
        controls = new CharacterInput();
    }
    void OnEnable()
    {
        if (!isRegistered)
        {
            isRegistered = true;
            didIRegister = true;
            controls.Enable();
            InputDeviceManager.RegisterInputAction("Submit", controls.UI.Submit);
            InputDeviceManager.RegisterInputAction("Cancel", controls.UI.Cancel);
            InputDeviceManager.RegisterInputAction("Fire1", controls.UI.Fire1);
        }
    }

    void OnDisable()
    {
        if (didIRegister)
        {
            isRegistered = false;
            didIRegister = false;
            controls.Disable();
            InputDeviceManager.UnregisterInputAction("Submit");
            InputDeviceManager.UnregisterInputAction("Cancel");
            InputDeviceManager.UnregisterInputAction("Fire1");
        }
    }
}
Thank you,
Nathan

Re: DS + UCC + New Input System

Posted: Wed May 26, 2021 8:27 am
by Tony Li
Hi Nathan,

If you keep an inspector view open on the EventSystem GameObject during play, does it detect UI buttons when the mouse hovers over them?

Does your dialogue UI's Canvas still have an enabled Graphic Raycaster component?

Re: DS + UCC + New Input System

Posted: Wed May 26, 2021 7:27 pm
by nathanj
Hi Tony

Weird, I thought I had it, but now I'm more confused.

If I delete the Event System and add a new one and use the default Input Actions the UI button responds. But
this is using different Action Assets (one for UI and one for player) and this is not liked by the player input module:
Image

If I click fix to sync them then I get the issue where the UI doesn't respond to mouse point or click.

Also, I get that this doesn't have anything to do with you, it was more just if anyone else here had come across this with their similar setups.

Re: DS + UCC + New Input System

Posted: Wed May 26, 2021 9:48 pm
by Tony Li
Try changing the EventSystem's Pointer Behavior dropdown. If that doesn't help, run it by the folks on the Opsive forum. I'm sure you're not the first person to ask, since they set up that CharacterInput Input Action Asset.

Re: DS + UCC + New Input System

Posted: Wed May 26, 2021 10:07 pm
by nathanj
Ok, so the issue is that with the CharacterInput Input Action Asset, none of the UI Action Maps' Actions are assigned to Control Schemes.

Assigning the correct Control Sceme fixed the issue.

Image

Thanks again for your time
Nathan