5
\$\begingroup\$

I have a Unity project in which I have 200 games and some 350 scenes. Now I want to make separate builds for each game. All my assets are present in Assets/IgnoredAssets/ABC folder. To include these assets in my current build the assets of the current game (say ABC) needs to be in Assets/Resources/ABC.

I want Unity to take these Assets/IgnoredAssets/ABC files and copy them to Assets/Resources before making build depending upon a constant defined in some file.

I want a kind of automation so that when I mention in my constant file string gameName="ABC"; it automatically picks its assets, paste them in Resources and builds for me.

How can I do this?

\$\endgroup\$
1
  • 3
    \$\begingroup\$ Go through AssetDatabase and BuildPipeline documentation. They have all the functions that you require to achieve the same. \$\endgroup\$
    – 2600th
    Sep 18 '14 at 18:16
1
\$\begingroup\$

First of, you should have separate projects for individual games and not all games in one project.

You can just move the assets around if you know what the current select game is. First, move the current game back.

AssetDatabase.MoveAsset("Assets/Resources/<filenanme>", "Assets/Resources/<currentgame>/<filename>");

Now, move the next game into the asset folder.

AssetDatabase.MoveAsset("Assets/IgnoredAssest/<newgame>/<filenanme>", "Assets/Resources/<filename>");
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.