When I open the menu on the simulator it errors with the error message “Program Error: Cannot read properties of undefined (reading ‘fields’)”, I don’t remember the last time I tried opening the menu in the project, and undoing recent changes doesn’t fix it. The project is https://arcade.makecode.com/S35839-18775-79454-54023
@Tyller_1 tldr: the issue here is your forever loop. move the pause to the bottom of the forever to fix it
to explain what’s going on here, you first need to understand that arcade has a concept of “scenes”. when you’re playing a game in arcade, there is always one active scene that holds all the state of the current game. the sprites, physics engine, tilemap, etc. are all stored on the scene.
when you press menu, arcade shoves your game’s scene aside and creates a new temporary scene for the pause menu. in theory, this will “pause” your game while the other scene runs for a while. when you press the B button, the pause menu scene is destroyed and your game’s scene starts running again.
this system works well except for one case: when you are paused in another thread (like a forever block). if you have paused, then there is a chance that your code will resume while the other pause menu scene is active. if you try and access something that exists on your game’s scene, like the tilemap, you’ll get an error.
moving the pause to the bottom of the forever fixes this because the forever loop won’t restart until your scene is back in charge. if you pause at the top, there’s nothing the forever loop can do to stop your code from running when the other scene is active.
Thank you!