Reacting to an overlay being closed
-
I have an overlay that allows you to buy items from a store and I need to update my UI in the scene below after closing the overlay. I've tried opening the overlay without pausing the scene and broadcasting a message, but the scene doesn't pick it up. I can set up a timer to periodically load a file and check if its contents have changed but this feels very inefficient. Any ideas?
-
@Stanica I tried this also as I have an overlay I use to buy upgrades for my main character. I tried the broadcast message and it also doesn’t work. You have to use save file and load file but the problem with that is it’s not instant as you are experiencing right now without adding a timer. What I had to do was create the overlay layer entirely on the U.I layer which just looks really messy. Would be nice if overlays worked on real time prior to the scene you are currently playing.
-
I also had this problem once, I think saving and loading is the only way to send data between scenes/overlays.
I use an overlay as my UI for one of my games because it's the main menu UI, it disappears when the game starts. This way I can run a 0s timer to load the file (so the main menu isn't really efficient) but the timer turns off once the game starts. If your game is sort of meant to pause while the Shop UI is up, just run the load behaviour on a 0s timer I don't think it matters too much if your game is running a bit inefficiently while you're paused or in a shop, just turn off the load timer once you're done.
-
@Aidan-Oxley I never considered disabling the timer after it ran. Thanks!
-
@SplitMindGaming For one of my modals I did the same thing you did and created the "overlay" on the UI layer. Messy but it works.