Forum begins after the advertisement:
[Part 9] Pause Menu when resume don’t take input anymore
Home › Forums › Video Game Tutorial Series › Creating a Metroidvania in Unity › [Part 9] Pause Menu when resume don’t take input anymore
- This topic has 3 replies, 3 voices, and was last updated 1 day, 20 hours ago by Terence.
-
AuthorPosts
-
November 16, 2024 at 6:39 pm #16369::
So i was making the pause menu, the quit to main menu and other function look good. But the thing is when I pause the game and click the resume button. I cannot move my character anymore, even attack or healing.
private void Update() { if(Input.GetKeyDown(KeyCode.P)) { SaveData.Instance.savePlayerData(); } if (Input.GetKeyDown(KeyCode.Escape) && !gameIsPause) { pauseMenu.fadeUIIn(fadeTime); Time.timeScale = 0; gameIsPause = true; } } public void unpauseGame() { Time.timeScale = 1; gameIsPause = false; }
I already put the
if(GameManager.Instance.gameIsPause) return;
in the enemy and player. Here the enemyprotected virtual void Update() { if(GameManager.Instance.gameIsPause) return; if (isRecoilling) { if (recoinTimer < recoilLength) { recoinTimer += Time.deltaTime; } else { isRecoilling = false ; recoinTimer = 0 ; } } else { UpdateEnemyStates(); } }
and here is the player
private void Update() { if (GameManager.Instance.gameIsPause) return; if (playerStateList.incutscene) return; if(playerStateList.alive) { getInput(); OpenMap(); OpenInventory(); } UpdateJump(); RestoreTimeScale(); if (playerStateList.dashing) return; FlashWhenInvi(); if (playerStateList.alive){ if (!iswallJumping) { Moving(); Flip(); Jump(); } }; Heal(); CastSpell(); if (playerStateList.healing) return; if (unlockWalljump) { WallSlide(); WallJump(); } if (unlockDash) { StartDash(); } Attack(); }
Is this error cause because of the potion of the if statement in the player script?
November 19, 2024 at 12:08 pm #16414::Try calling the unpause function then the fade time, it might be possible that the fade time is calling delta time and it won’t be completed for the game to be unpaused
try putting the fadeUIout within the unpause game functionpublic void UnpauseGame() { Time.timeScale = 1; pauseMenu.FadeUIOut(fadeTime); gameIsPaused = false; }
then just call for unpausegame in the Onclick() for resume
has upvoted this post. November 19, 2024 at 3:34 pm #16420::So i tried as you said. But it doesn’t solve the problem. When I click the resume. All the thing still can move like the boss but my character cannot get my input. I cannot attack or doing anything as the below record.
Resume error
And I also want to as you for another question. My boss when doing the dive attack, he only create 1 pillar instead of many like in the video, and the pillar when spawn is spawning in some very weird location. Also the pillar will one hit me because it deal multiple time damage to player in a very shot time. Could said in every frame of the animation. Can you help me fix this?November 20, 2024 at 11:08 am #16446 -
AuthorPosts
- You must be logged in to reply to this topic.
Advertisement below: