Forum rules - please read before posting.

Starting a new game via a custom main menu scene?

edited September 2017 in Technical Q&A
Me again. I'm making a basic main menu/title screen scene for my game, and for now that simply consists of a panel with a "new game" button and a "load saved game"
button (both Unity UI buttons). I have a script attached to this panel with a method for each button's OnClick event. Those methods each tell a different action list asset to run when I click a button.

Right now the way I'm starting a new game is by running Engine: End game and Restart game in the action list asset that's called when I press the "new game" button. It appears to work, but is this the proper way to go about it, or is there something I could call in the code instead? Or if I link menus with Unity UI (which I'm looking into now), is there an easy way to start a new game that way?


Comments

  • The "Restart game" method is only necessary if you want to restart the game midway through an already-started game, i.e. one where variables/scene data have changed.  If the Menu is only accessible when the game begins, and no other time, then a Scene: Switch Action is enough.

    However, the "Restart game" method is a safe way of both switching scene and ensuring that all variables / scene data is reset - so that should be fine.

    Linking AC's Menu system to Unity UI is the recommended way of working with Unity UI / ActionLists, as it allows you to automatically connect ActionLists to button clicks, and have your UI controlled automatically.  For more, see Section 11 in the Manual for more on Menus, Unity UI, as well as the Menus series of tutorials.  This one covers the conversion of AC to Unity UI menus, while the 2.5D tutorial covers the process in video form.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.