Trying out this modified:
ButtonProxy.cs
using System;
using UnityEngine;
using UnityEngine.UI;
public class ButtonProxy : MonoBehaviour
{
Button nextButton;
[SerializeField] Button firstChoiceButton;
[SerializeField] Button secondtChoiceButton;
private KeyCode key;
private void Awake()
{
nextButton = GetComponent<Button>();
}
public void SetKey(KeyCode keyCode)
{
key = keyCode;
}
private void Update()
{
if (key < 0) return;
if (Input.GetKeyDown("return"))
{
nextButton.onClick?.Invoke();
}
if (Input.GetKeyDown("escape"))
{
}
if (Input.GetKeyDown(KeyCode.Alpha1))
{
firstChoiceButton.onClick?.Invoke();
}
if (Input.GetKeyDown(KeyCode.Alpha2)){
secondtChoiceButton.onClick?.Invoke();
}
}
}
Also tried adding a listener in DialogueUI.cs and a serialized field referencing the choices. Does not have to be very complex just 3 choices for example. Clicking next with Enter works just fine but the choices dont work. I was suggested by Brian who discovered why my button was not registering clicks in the first place. He went further as to suggest an awesome method for using the Input Keys and I have some trouble with the choices. The problem lies I think that I do not know how to use an index for the responses choice and not sure if I need to create an extra function specifically for that if I don’t use the mouse for selecting.