Interlocking key configuration with conversation start button
-
- Posts: 36
- Joined: Sun Jul 14, 2024 2:35 am
Interlocking key configuration with conversation start button
Hello.
I created a key configuration using InputSystem's Rebinding, but it is not reflected in the conversation start button.
With reference to the documentation, I created a script that outputs the Input System in C# and passes button input to ProximitySelector.
Should I add a command to the script that passes key input to the Input System?
I don't know what to do, so could you please tell me?
I created a key configuration using InputSystem's Rebinding, but it is not reflected in the conversation start button.
With reference to the documentation, I created a script that outputs the Input System in C# and passes button input to ProximitySelector.
Should I add a command to the script that passes key input to the Input System?
I don't know what to do, so could you please tell me?
Re: Interlocking key configuration with conversation start button
Hi,
Did you register that input action with the Dialogue System's InputDeviceManager as described on page 5 of the Input_Device_Manager_Manual.pdf included in the Dialogue System or in the tutorial video?
Did you register that input action with the Dialogue System's InputDeviceManager as described on page 5 of the Input_Device_Manager_Manual.pdf included in the Dialogue System or in the tutorial video?
-
- Posts: 36
- Joined: Sun Jul 14, 2024 2:35 am
Re: Interlocking key configuration with conversation start button
I created a script like this by referring to that pdf.
The buttons can be operated, but the buttons after key configuration are not reflected and are in the default key state.
Is there anything else I need to do?
The buttons can be operated, but the buttons after key configuration are not reflected and are in the default key state.
Is there anything else I need to do?
Code: Select all
using UnityEngine;
using UnityEngine.InputSystem;
using PixelCrushers;
public class Controls : MonoBehaviour
{
protected static bool isRegistered = false;
private bool didIRegister = false;
private KeyAction controls;
void Awake()
{
controls = new KeyAction();
}
void OnEnable()
{
if (!isRegistered)
{
isRegistered = true;
didIRegister = true;
controls.Enable();
InputDeviceManager.RegisterInputAction("Submit", controls.UI.Submit);
}
}
void OnDisable()
{
if (didIRegister)
{
isRegistered = false;
didIRegister = false;
controls.Disable();
InputDeviceManager.UnregisterInputAction("Submit");
}
}
}
Re: Interlocking key configuration with conversation start button
Hi,
Where are you using "Submit"? For example, are you using a Selector component? If so, you would set the Use Button to "Submit" (without quotes). Can you provide screenshot(s) of your configuration?
Where are you using "Submit"? For example, are you using a Selector component? If so, you would set the Use Button to "Submit" (without quotes). Can you provide screenshot(s) of your configuration?
-
- Posts: 36
- Joined: Sun Jul 14, 2024 2:35 am
Re: Interlocking key configuration with conversation start button
Hello.
"Submit" is attached to the Player's "ProximitySelector" and used to start a conversation.
We will also send the settings for EventSystem.
"Submit" is attached to the Player's "ProximitySelector" and used to start a conversation.
We will also send the settings for EventSystem.
Re: Interlocking key configuration with conversation start button
Hi,
Have you added your Controls script to a GameObject such as the Dialogue Manager?
Are there any errors or warnings in the Console window?
Have you added your Controls script to a GameObject such as the Dialogue Manager?
Are there any errors or warnings in the Console window?
-
- Posts: 36
- Joined: Sun Jul 14, 2024 2:35 am
Re: Interlocking key configuration with conversation start button
Hello.
I am assembling it by watching videos and pdfs.
Of course, I attached a Controls script to Dialogue Manager.
There are no errors.
Operation with the default keys is possible.
It's just that it's not reflected when I keybind InputSystem.
I am assembling it by watching videos and pdfs.
Of course, I attached a Controls script to Dialogue Manager.
There are no errors.
Operation with the default keys is possible.
It's just that it's not reflected when I keybind InputSystem.
Re: Interlocking key configuration with conversation start button
Hi,
Unlike dialogue UIs (response menu buttons, continue button), the Selector doesn't use the Unity UI EventSystem. When your script registers "Submit" with the InputDeviceManager, the InputDeviceManager will make a link between the string "Submit" and your Controls script's Submit input action. At runtime, the Selector then asks the InputDeviceManager is "Submit" is currently pressed, which makes the InputDeviceManager ask your Controls script if the Submit input action is pressed.
Maybe the problem is that it's named "Submit", which is also a name used by the Unity UI EventSystem. Can you try a different input action name such as "Use" or "Interact"?
Unlike dialogue UIs (response menu buttons, continue button), the Selector doesn't use the Unity UI EventSystem. When your script registers "Submit" with the InputDeviceManager, the InputDeviceManager will make a link between the string "Submit" and your Controls script's Submit input action. At runtime, the Selector then asks the InputDeviceManager is "Submit" is currently pressed, which makes the InputDeviceManager ask your Controls script if the Submit input action is pressed.
Maybe the problem is that it's named "Submit", which is also a name used by the Unity UI EventSystem. Can you try a different input action name such as "Use" or "Interact"?
-
- Posts: 36
- Joined: Sun Jul 14, 2024 2:35 am
Re: Interlocking key configuration with conversation start button
I changed the name to "Talk" as a trial.
I thought the south button was in the wrong place, so I checked by using the left stick as the default button.
But it will behave the same as before.
What should I do?
I created the key configuration method for InputSystem by referring to the following site.
I'm Japanese, so this is a Japanese site.
https://gamedev65535.com/entry/unity_in ... rebinding/
I thought the south button was in the wrong place, so I checked by using the left stick as the default button.
But it will behave the same as before.
What should I do?
Code: Select all
using UnityEngine;
using UnityEngine.InputSystem;
using PixelCrushers;
public class Controls : MonoBehaviour
{
protected static bool isRegistered = false;
private bool didIRegister = false;
private KeyAction controls;
void Awake()
{
controls = new KeyAction();
}
void OnEnable()
{
if (!isRegistered)
{
isRegistered = true;
didIRegister = true;
controls.Enable();
InputDeviceManager.RegisterInputAction("Talk", controls.UI.Talk);
}
}
void OnDisable()
{
if (didIRegister)
{
isRegistered = false;
didIRegister = false;
controls.Disable();
InputDeviceManager.UnregisterInputAction("Talk");
}
}
}
I'm Japanese, so this is a Japanese site.
https://gamedev65535.com/entry/unity_in ... rebinding/
Re: Interlocking key configuration with conversation start button
Hi,
Here's an example:
DS_RebindInputSystemExample_2024-07-25.unitypackage
It's a copy of DemoScene1, but I replaced the DemoInputRegistration script with a copy that also listens for the [F1] key. When the [F1] key is pressed, it rebinds the "Fire1" input action to the "E" key. When you look at the NPC and press "E", it will start the conversation.
Here's an example:
DS_RebindInputSystemExample_2024-07-25.unitypackage
It's a copy of DemoScene1, but I replaced the DemoInputRegistration script with a copy that also listens for the [F1] key. When the [F1] key is pressed, it rebinds the "Fire1" input action to the "E" key. When you look at the NPC and press "E", it will start the conversation.