Skip to main content
GameDev.net gamedev.net
🔒 Locked

Automatically changing scenes in Unity build when changing the platform

Started by NDraskovic Jan 15, 2018 at 9:15 AM 3 replies 3.3k views
Original Post
NDraskovic
NDraskovic

Hey guys,

Like the title says, I'm trying to find out if it's possible to automatically set which scenes will be built for different platforms. For instance, I have scenes that I want to include when building for PC, but exclude them for mobile platforms. Is it possible to do this automatically (by some settings file, or by coding some editor extension), or do I have to manually (de)select them each time I switch platforms?

Google just keeps sending me to the documentation sites about the regular publishing, but I can't find information about this problem.

Thanks in advance

NDraskovic
NDraskovic

Thanks, I'll take a look.

zer0force
zer0force

Second you use the Unity Commandline , to execute the build:
C:\program files\Unity\Editor\Unity.exe -quit -batchmode -executeMethod MyEditorScript.PerformBuild

I think if you include the reading of a JSON txt file in your "MyEditorScript" method you can further customize the code like:

"build.info":
{"platform":"Windows","scenes":"Scene1|Scene2|Scene3"}
{"platform":"Mac","scenes":"Scene4|Scene5|Scene6"}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.