Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

How to safely exclude a level from the build?

Discussion in 'FPS.Sample Game' started by nevermorint, Jan 13, 2019.

  1. nevermorint

    nevermorint

    Joined:
    Oct 17, 2013
    Posts:
    8
    Hi guys, I've started fiddling with the project recently and actually managed to add, remove levels and build the game.
    I've got rid of level_01 and testlevel with no problems, built and played the game, no biggy.
    When I removed level_00, I screwed up the registries of some prefabs and wasn't able to fix them.
    Is there any way safe to exclude levels from the build without screwing the asset registries ?

    EDIT: When I said "removed levels" I meant removed those scenes folders and commented their references on MainMenu.cs
     
    Last edited: Jan 16, 2019
  2. karstenv

    karstenv

    Joined:
    Jan 12, 2014
    Posts:
    66
    Just curious, what size did you build end up as?

    EDIT: I tried to exclude Level_01 from the build using its LevelInfo component and unticking "Include in build".

    It seems like the level is still included in the build if done this way.
     
  3. nevermorint

    nevermorint

    Joined:
    Oct 17, 2013
    Posts:
    8
    Thanks for the tip karstenv! Didn't noticed that tick.
    Build ended up with 4Gb+.
     
  4. nevermorint

    nevermorint

    Joined:
    Oct 17, 2013
    Posts:
    8
    Ok mate so I gave it a try and actually managed to exclude Level_01 from the build.

    So, after unticking "Include in Build" you have to build the game from "Project Tools" tab first and then build the game for the desired platform.

    Oh man thanks a lot ahah
     
  5. karstenv

    karstenv

    Joined:
    Jan 12, 2014
    Posts:
    66
    Cool, Will try this later :)
     
  6. karstenv

    karstenv

    Joined:
    Jan 12, 2014
    Posts:
    66
    I just did a new build and ended on 700+ mb.

    So you should remember to delete (or rename it) your old build folder first.

    Then rebuild the assets in the project tool.
    Then single build your own levels.
    Then do a Build game.

    This should give you a very reduced build folder size.

    I automaticly thought that building the game would delete the old stuff but it makes sense that it doesn't as the old resources are just present in the folder.
     
  7. nevermorint

    nevermorint

    Joined:
    Oct 17, 2013
    Posts:
    8
    Sweet!
    Generally I immediately rename the new build folder, saved myself another headache trying to figure out why the levels were still there :p

    Did you kept the main menu? my last build only included the menu scene and my own, ended up with 1.5Gb +-
    I presume most of that is from the assets used in the menu scene, 2 characters, background, animations and sound.
    Now you got me curious why the 700Mb :p
     
  8. karstenv

    karstenv

    Joined:
    Jan 12, 2014
    Posts:
    66
    Yeah I have kept the menu scene for now but it is fairly big so I'll delete most of the content from it at some point.

    Well my 700+ is actually 790 mb but still.
    I only excluded Scene_01 and then added 2 small scenes of my own so...
     
    nevermorint likes this.
  9. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    168
    Nice work guys!
    De-checking "include in build" on the level_info for each level, should exclude it from the builds.

    AS for registries! These things are fun, lol... If you delete a pre-fab that is registered in on of the registries, before you un-register it. You are screwed.

    Same goes for if you copy a prefab that is registered, before un-registering it, that pre-fab-copy will go ahead and try to slam it self into the registery and screw it up too!

    It best when creating, to add all the stuff and not copy, then register it correctly as new. FPS 1.1 (prior registries were done differently)

    So you will need to go into each pre-fab that is not going to be used, and de-register it, to cleanly delete it... Well, and be sure all references to those prefabs are no longer called... You can do that, by going directly to the registries and tracking down each item that is registered in each register and un-registering it before you delete it.

    BE SURE YOU DON'T NEED IT, and are not referencing it anywhere, before you do this. Or its going to be a bad time... :D

    The registry's are stored here : Bundled Resources\Shared\
    <See attached>
     

    Attached Files: