Create overlay minigame and pause the main scene?

Hey guys, first time poster here. I’ve done some searching about this question, both on these forums and through Google, and I haven’t found any answers that relate to my specific situation.

I’m trying to make a mini-game that pops up in an overlay, pausing the main scene underneath until the user finishes the mini-game. For clarification, it works similarly to the hacking minigame in Bioshock 1 (the mechanics of the minigame itself are different, but the interaction between it and the main game is the same).

There are two ways I can think to do this:

  1. Pause the scene, load a 2nd scene as an overlay, (when user finishes) update my global variables with the changes made by the mini-game (new items won, doors unlocked, etc.), delete the overlay, and unpause the main scene
  2. Serialize and save the scene data, load a completely separate scene, do the minigame stuff (as in #1), reload the 1st scene from the saved data.

I have no clue how to develop either option! :slight_smile:
I mean, theoretically, I know how it would go. But specifics of scripting? That’s another story.

If you could give me some tips, point me in the right direction, explain how you would go about creating this setup, or even link to an external article or something, that would be awesome.

I’ve used the forums in the past to find answers to questions that other people have asked previously. I know you guys are awesome. The unity community seriously rocks.

I think the deciding factor here is how large (in terms of memory usage) your minigame and main scene are, and how often you’ll be switching between them.
Overlaying obviously avoids the time to reload the main scene, but does put both in memory at the same time.

As far as specific implementation details, I’ve done this, but not in Unity, so I’m not sure how useful any code would be to you. What kind of questions did you have about it? The basic setup is pretty simple, it’s just making sure that everything is paused or serialized correctly that gets tricky.

Hey, thanks for replying.

Actually, the minigame will be very lightweight, especially in comparison with the main scene. One of the key design constraints on the project is compatibility with computers ~5-7 years old, so neither minigame nor main game will have tons of geometry/objects/etc.

The questions I have about implementation have to do with algorithm. What exactly am I telling the computer to do? What kind of data do I have to get, store, load, and so forth? Basically, how should I think about the process? Working with multiple concurrent scenes is something that I am not knowledgable about at all… :smile:

Any example code you can provide would probably be very helpful. Even if I can’t plug-and-play, I could probably reverse-engineer it to a point.