- Home /
BuildPipeline.BuildPlayer Question
Build streamed scene file into a seperate unity3d file,All script is missing,How to solve?I'm thinking that Unity is not building my scripts?
using UnityEngine; using UnityEditor; using System.Collections;
public class SimpleBuilder : EditorWindow {
[MenuItem("Tools/SimpleBuilder")]
private static void OpenBuilder() {
new SimpleBuilder().Show();
}
void OnGUI() {
if (GUILayout.Button("Build")) {
string[] scenes = new string[] {"Assets/Islands.unity"};
string filename = EditorUtility.SaveFilePanel("Save Player", "", "Unity Player (SimpleBuilder)", "app");
BuildPipeline.BuildPlayer(scenes, filename, BuildTarget.WebPlayer, BuildOptions.BuildAdditionalStreamedScenes);
Close();
}
}
}
Do you get a compile error? Do you have this script in a folder called "Editor"? does it also not work in an empty project?
Answer by equalsequals · May 26, 2010 at 03:04 PM
One thing I see is that you're passing in null to your BuildPipeline.BuildPlayer's first parameter. That should be an array of strings which are the asset paths to your scenes you want bundled. The second parameter is the full string path of the file you want to create. We make a separate folder called "Build" outside of our project's Assets folder and set it up that way but you can do whatever works for you.
To do one scene per bundle: (C#)
string[] _levels = new string[1]; _levels[0] = AssetDatabase.GetAssetPath("MySceneNameHere");
BuildPipeline.BuildPlayer(_levels, path + "MySceneNameHere" + ".unity3d", BuildTarget.WebPlayer, BuildOptions.BuildAdditionalStreamedScenes);
This is some slightly modified code from a tool I built to automate this sort of thing for my company's web games.I might have messed something up but if I didn't it should work.
Cheers,
==
It should compile any script used in the scene, I believe.
I'm thinking that Unity is not building my scripts. here is the log file. If you see any thing thats wrong please help me out.
Your answer

Follow this Question
Related Questions
Unity5. How to build asset bundles and player with dependencies? 0 Answers
Build Player from Command Line 2 Answers
Unity standalone build removes PDB files from output folder 1 Answer
System.Collections error while building the player for windows phone 8 1 Answer
Can't use BuildFile.path. 0 Answers