the problem i’m facing here is, while firing or moving when i press chat button
AllowGameplayInput is set to false but the player is still on the previous state(moving or running)before the button press…
I had to implement the same thing for Ultimate FPS support in the Dialogue System for Unity. It sets the player’s state to “Freeze”. (See the UFPS manual’s States section.) Here’s a code snippet from the Dialogue System:
/// <summary>
/// Freeze the UFPS player (i.e., gameplay) and show the mouse cursor.
/// </summary>
public void Freeze() {
if (fpController != null) {
fpController.SetState("Freeze", true);
fpController.Stop();
}
if (fpPlayerEventHandler != null) {
savedCrosshair = fpPlayerEventHandler.Crosshair.Get();
fpPlayerEventHandler.Crosshair.Set(null);
}
if (fpCamera != null) fpCamera.SetState("Freeze", true);
if (fpInput != null) fpInput.enabled = false;
if (hideHUD && (fpHUD != null)) fpHUD.enabled = false;
ShowCursor();
}
/// <summary>
/// Unfreeze the UFPS player (i.e. gameplay) and restore the previous cursor state.
/// </summary>
public void Unfreeze() {
if (fpController != null) fpController.SetState("Freeze", false);
if (fpPlayerEventHandler != null) fpPlayerEventHandler.Crosshair.Set(savedCrosshair);
if (fpCamera != null) fpCamera.SetState("Freeze", false);
if (fpInput != null) fpInput.enabled = true;
if (hideHUD && (fpHUD != null)) fpHUD.enabled = true;
RestorePreviousCursorState();
}