Hey support,
using Unity 2021.3.10f1
using Unity Input System 1.4.1
So I noticed that whenever I have the play mode options enabled (meaning that reload domain and reload scene are disabled, just the Enter play Mode Options are checked in order to quickly enter the play mode)
my Input code behaves faulty:
For example:
public void OnProgressDialogue(InputAction.CallbackContext context)
{
if (context.performed)
{
Message.Raise(new ProgressDialogueEvent());
}
}
OnProgressDialogue gets called when I hit the spacebar.
Now this method will get called twice in this scenario, which means the event will get raised twice.
This does not happen with a build and also it does not happen when the EnterPlayModeOptions are disabled, than the method gets executed exactly as it should: once.
I’ve read like about two years ago that the Input System didnt yet support EnterPlayModeOptions, is this still the case? Or is there a another setting I need to enable to make it work with EnterPlayModeOptions?
Edit: This is the whole class I use:
public class DialogueInputBehaviour : MonoBehaviour,
IUiInputBehaviour,
MOHInputActions.IDialogueActions
{
private IGameInput gameInput;
public void InitInputBehaviour(IGameInput input)
{
gameInput = input;
}
public void RegisterInputCallbacks()
{
gameInput.GameInputActions.Dialogue.SetCallbacks(this);
}
public void UpdateInputBehaviour()
{
}
public void OnProgressDialogue(InputAction.CallbackContext context)
{
if (context.performed)
{
Message.Raise(new ProgressDialogueEvent());
}
}
public void OnEnterMainMenu(InputAction.CallbackContext context)
{
if (context.performed)
{
Message.Raise(new OpenMainMenuEvent());
}
}
public void DisposeInputBehaviour()
{
// Didnt work
gameInput.GameInputActions.Dialogue.SetCallbacks(null);
// Didnt work
gameInput.GameInputActions.Dialogue.Disable();
// Didnt work:
gameInput.GameInputActions.Dialogue.ProgressDialogue.Dispose();
gameInput.GameInputActions.Dialogue.EnterMainMenu.Dispose();
}