Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved unclickable while paused

Discussion in 'Visual Scripting' started by SacramentoCA, Apr 28, 2023.

  1. SacramentoCA

    SacramentoCA

    Joined:
    Apr 6, 2023
    Posts:
    4
    Hello, Everyone!

    Imagine a game like Tetris. Different figures drop, but they are destroyable by clicks. While the game is paused and pause menu appears, figures are still clickable even through buttons. Although, button behind menu is not interactable. I use Visual Scripting if it matters.

    Just started to learn unity, so maybe I'm just missing something.

    Thanks for reading!
     
  2. rell023

    rell023

    Joined:
    Mar 29, 2023
    Posts:
    18
    Not familiar enough with Unity to say if there's a simpler solution, but I imagine you could create a scene bool for pause, and filter every click event on the GameObjects you don't want clicked through an if statement off of that boolean and just put nothing after the true exec pin and run the rest of your logic off of the false pin.
     
  3. Welfarecheck

    Welfarecheck

    Joined:
    Jun 14, 2020
    Posts:
    98
    You can't set the timescale to 0 to pause. You need to set it to 0.01 or something small so the game is still simulating so the buttons work. At that speed, UI will work and the game will be effectively paused.
     
  4. SacramentoCA

    SacramentoCA

    Joined:
    Apr 6, 2023
    Posts:
    4
    Thank you for your answer!

    Buttons are working properly. Button "pause" which is behind the pause menu doesn't work as it should. But the objects are still clickable for some reason.
     
  5. SacramentoCA

    SacramentoCA

    Joined:
    Apr 6, 2023
    Posts:
    4
    Thank you for your answer!

    I thought that there is a solution through object scripts. Like: on mouse input if timescale = 0; true = "do what it should", false = do nothing. But I guess there might be an easier solution, maybe somewhere in canvas settings or smth like that. Not so sure as well ...