|
I'm using a C# script to call BuildPipeline to make standalone and web player versions of our simulation. I couldn't find a way to access the list of scenes to build under the Build Settings UI. Now I see in Library there's a file called BuildSettings.asset. Can I use the AssetBundle API to load this and read the build settings automatically from my project so as not to hardcode the list of scenes into my project file? If not, where can I access the list of scenes that are displayed in the Build Settings UI?
(comments are locked)
|
|
Maybe what you are seeking is the editorbuildsettings.scenes ? I don't know if you can add new scenes to it, but It provides the information you want to have (path to the scene and if it is enabled in your building scene settings). hope that was helpful. regards Edit: tried myself to add new scenes to the scenes and it works. So if you have all your gamescenes in one directory you can read all filenames from this directory and add them to the editorbuildsettings.scenes automatically.
(comments are locked)
|
|
You can do something like the following in order to modify the set of scenes in the 'Build Settings' menu via an editor script: var original = EditorBuildSettings.scenes; var newSettings = new EditorBuildSettingsScene[original.Length + 1]; System.Array.Copy(original, newSettings, original.Length); var sceneToAdd = new EditorBuildSettingsScene("Assets/Path/To/Scene/sceneName.unity", false); newSettings[newSettings.Length - 1] = sceneToAdd; EditorBuildSettings.scenes = newSettings; That will add a new scene to the list of scenes. You can remove scenes or modify the 'enabled' property by accessing the same EditorBuildSettings.scenes array.
(comments are locked)
|
|
While you cannot change the selected scenes displayed in the build settings window from a script, you can make custom builds using BuildPipeline.BuildPlayer, which lets you pass the scenes to build as a parameter. Right but I don't want to have to specify the names of the scenes, I want to access the list of scenes to compile from wherever they are stored when they are set by the user in Unity. Then if the user were to edit the list of scenes in the Build Settings UI, my continuous integration script would automatically include the new scene. As it is now, the scene list is hardcoded in the build script and so has to be updated if the build settings are changed.
Jan 24 '10 at 04:49 AM
Ben 2
I don't think it is possible to get this information from a script. My advise is to implement a custom build solution using BuildPipeline.BuildPlayer, and implement your own scene list management.
Jan 24 '10 at 02:19 PM
jonas echterhoff ♦♦
(comments are locked)
|
(comments are locked)
|
|
a hacky way I found to do it is just read the EditorBuildSettings.asset file in as a string and scan for ".unity". The scene paths are stored in there, but so is the build name so make sure the ".unity" isn't followed by "3d" Yeah, if doing this from a command line script in OS X or similar OS you can use 'strings -a BuildSettings.asset | grep unity' and you'll see the list there. Its an ok answer but as you said, its a hack.
Aug 02 '10 at 05:56 PM
Ben 2
Hi, I tried doing this from inside Unity using a streamreader and the www class. Both methods fail and return an empty file. Any ideas? Note: When i open the file in notepad the file has text in it (and symbols etc) but when i open it inside monodevelop it appears empty. editorbuildsettings.scenes is useless for what i want to do because it only works inside an editor script >.<. Massive fail unity3d.
May 26 '11 at 09:46 AM
Gungnir
(comments are locked)
|
1 2 next page »
