Search Unity

What creates the Game object in a standalone build?

Discussion in 'FPS.Sample Game' started by Mrb83, Feb 17, 2019.

  1. Mrb83

    Mrb83

    Joined:
    May 12, 2013
    Posts:
    8
    This is probably going to end up being a daft question, but what in the FPSSample project creates the
    Game
    object instance in a standalone (non-editor) build?

    As far as I can tell, the
    Game.cs
    file only exists on the
    Game.prefab
    . And the only thing I can see that instantiates that prefab is
    ScenePostProcessor.cs
    . However this class is editor only so isn't included in a standalone build.

    I tried attaching a debugger to a standalone build with
    System.Threading.Thread.Sleep(10000)
    inside
    Game.Awake()
    , followed by a breakpoint. The breakpoint is hit, but
    Game.Awake()
    is the only function shown in the call stack! That's helpful..

    So please, edumacate me. What the hell creates the
    Game
    object instance in a standalone build? Thanks!
     
    Last edited: Feb 17, 2019
  2. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    157
    Howdy MrB83,

    When you open up the Project Tools, you can load the Boot Loader screen. Inside that scene, there is a gameobject with game.cs attached to it :)

    That's the start, that and boot.cfg and user.cfg

    Cheers
    Micah
     
    Mrb83 likes this.
  3. Aquastar

    Aquastar

    Joined:
    Jul 17, 2013
    Posts:
    25
    When you build the game, BuildTool will add levels "Assets/Scenes/bootstrapper.unity" and "Assets/Scenes/empty.unity". You can review the code in BuildTool.cs.
     
    Mrb83 and AggressiveMastery like this.
  4. Mrb83

    Mrb83

    Joined:
    May 12, 2013
    Posts:
    8
    Thanks a lot guys!

    I probably should have figured that out just based on the name, even though I never explicitly load the boot scene myself.

    I'm now using the Project Search and Replace asset which allows you to search across not just prefabs but scenes too :)

    Thanks again
     
    Last edited: Feb 18, 2019