Add an Exit Option to the Title Screen

Author: Companion Wulf
¶ Thanks to Mad Stuntman for his fixes and tweaks.

This is how to add an EXIT option to your SMILE GAME BUILDER games once they’re exported into Unity.

Depending on which version of Unity you use, the edits will be slightly different.

The following are for vertical menus only (Game Data → Start Menu → Start Menu Layout → List Horizontally).
Unity 2017
Version Used: 2017.4.29f1

src/common/Rom/GameSettings.cs

  • Look for public string selectItemOptionText = "";.
  • Add as Line 117:
    public string selectItemExitText = "Exit";
src/engine/TitleDrawer.cs

  • Go to Line 22:
    public enum SelectItemKind
      {
        NewGame,
        Continue,
         Option,
      }
  • Add as Line 27 right after "Option,":

    ExitGame,

  • Go to Line 279.
  • Add the following as Line 279:

    selectItemsData.Add(new SelectItem() {
    selectItemKind = SelectItemKind.ExitGame, itemText = title.selectItemExitGameText, });

src/engine/TitleScene.cs

  • Add using UnityEngine (on Line 7).

    ¶ This fixes the errors relation to Application.

  • Add as Line 325:
    case TitleDrawer.SelectItemKind.Exit:
      QuitGame();
      break;
  • Add as Line 350:
    #if UNITY_EDITOR
      UnityEditor.EditorApplication.isPlaying = false;
    #else
      Application.Quit();
    #endif
Unity 2018
Version Used: 2018.4.2f1

¶ This is still being worked on. Be patient and I’ll update soon!

Unity 2019
Version Used: 2019.3.0a5

¶ This is still being worked on. Be patient and I’ll update soon!