Как убедиться, что анимация не воспроизводится при нажатии кнопки в меню паузы
Hi guys, I need help with animation playing whenever UI button in pause menu is clicked in Unity 3D, that is, when left-click of a mouse is cliked, the character in the game plays attack animation but the animation also plays when I click resume button again with left-click of the mouse in pause menu. The question is how is it possible to ensure that attack animation is not played after I click resume button. The similar problem happens when the player enters a trigger there appears a UI panel containing buttons and when one of those buttons are clicked again attack animation is played and I do not want to let that happen. Down below is th code I am using:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PauseMenu : MonoBehaviour { public static bool IsPaused = false; public GameObject pauseMenuUI; public GameObject Player; // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { if (IsPaused) { Resume(); } else { Pause(); } } } public void Resume() { pauseMenuUI.SetActive(false); Time.timeScale = 1f; IsPaused = false; } void Pause() { pauseMenuUI.SetActive(true); Time.timeScale = 0f; IsPaused = true; } public void QuitGame() { } public void MainMenu() { Application.Quit(); } }
Что я уже пробовал:
Я попытался использовать setrigger и resettrigger