How to use a toggle button. pause and resume the game?
add boolean variable “paused”
add ui layer
make actions:
if button on UI layer (or smth else) pressed, paused = false, trigger once
then set timescale of base layer(the layer with game) to 0, set paused to true
if button on UI layer pressed, paused = true, trigger once
then set timescale of base layer to 1, set paused to false
P.S., as i know you can check key pressing even if timescale is 0 so you can use escape key instead of special ui button and layer
if you want to use TOGGLE button, then you can check every tick if toggle button if on/off and use actions i typed here