Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Multi builds using same engine but different resources folder.

Discussion in 'Scripting' started by Saxi, Feb 17, 2015.

  1. Saxi

    Saxi

    Joined:
    Jun 28, 2013
    Posts:
    381
    I'm trying to figure out the best way to handle this.

    I have a game I built that has 5 versions. The main engine and then there are json, png, mp3 files that are unique for each version. There is a master JSON that is loaded for the particular version, and maps all the png and mp3 files and private json files.

    The problem is I am using resources folder for all the images and sound fx so I don't have to create prefabs for all the levels and packs.

    I initially had a single Resources folder in the root, and I was going to swap out the assets. But I have since created a new folder and have each game as a sub folder and a separate Resources folder under each.

    Unity will still include all these resources folders during a build though, and I can't easily make changes for each game (bundle id, icons, and other unique properties for each version of the game).

    tl;dr I have five+ versions of a game that use the same engine, but different png/json/mp3 files. I want a way to easily build each of these without maintaining five+ projects and keeping them updated. Using Resources folder not prefabs, so I can't relay on Unity to only include what is being used and I need unique settings for the build so they have their correct icon, bunder ID and other settings.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,494
    I know there is an asset store package that allows you to keep multiple built targets in place at once, like iOS and Android and PC, so when you change targets it doesn't rebuild.

    Based on that being possible, could you write an Editor script that has a bunch of radio buttons on it, and when you click on button 1 through 5, it goes through five pre-defined locations and renames the Resources folder to be Resources_OFF or something like that, so that when you press Build, Unity won't include the ones that are off??

    For extra credit, perhaps you can change the package identifier each time you hit a new radio button...
     
  3. Saxi

    Saxi

    Joined:
    Jun 28, 2013
    Posts:
    381
    I know of two assets that do build settings as well as possibly others. I know if I move the folders that include "Resources" I can build without them, but I don't know if there is a way to get Unity to ignore a folder that has Resources in it, I know by default it will include it in build, but is there an api call that can have Unity ignore a folder or something in the build pipeline?

    Was also curious if there just was a better way to handle it, if I was just going about it all wrong.