Advertisement

Automatically changing scenes in Unity build when changing the platform

Started by January 15, 2018 09:15 AM
3 comments, last by zer0force 6 years, 10 months ago

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

Never done, but this should work:
https://docs.unity3d.com/Manual/BuildPlayerPipeline.html

For example this would allow you to create one method for each platform and pass the related scenes.

Advertisement

Thanks, I'll take a look.

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"}
 

This topic is closed to new replies.

Advertisement