Show Key Bindings in Dialog
Posted: Wed Nov 23, 2022 10:49 am
Hey,
i want to show the actuel key binding from New input system as a turtorial with the Dialog Manager. I didnt find a good way. I tryed this but it dos not work.
is here a normal way to do it ?
i want to show the actuel key binding from New input system as a turtorial with the Dialog Manager. I didnt find a good way. I tryed this but it dos not work.
is here a normal way to do it ?
Code: Select all
public void OnControlChanged()
{
playerInput = GetComponent<PlayerInput>();
inputActionJump = playerInput.actions["Jump"];
if (inputActionJump.GetBindingDisplayString() == null){ return; }
int i = 0;
foreach (var item in dialogDatabase.variables)
{
if (dialogDatabase.variables[i].Name == "JumpKey")
{
if (inputActionJump.GetBindingDisplayString() == null) { return; }
dialogDatabase.variables[i].InitialValue = inputActionJump.GetBindingDisplayString();
}
i++;
}
}