「Unity/Editor/プレイヤービルド」の版間の差分
提供: 初心者エンジニアの簡易メモ
行27: | 行27: | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
+ | BuildPipelineの公式マニュアル:http://docs.unity3d.com/ja/current/ScriptReference/BuildPipeline.BuildPlayer.html |
2021年8月3日 (火) 17:56時点における版
Assets/Editor/BuildPlayerExample.cs
using UnityEditor; using UnityEngine; using UnityEditor.Build.Reporting; public class BuildPlayerExample : MonoBehaviour { [MenuItem("Build/Build WebGL")] public static void MyBuild() { BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions(); buildPlayerOptions.scenes = new[] { "Assets/Scenes/SampleScene.unity" }; buildPlayerOptions.locationPathName = "WebGLBuild"; // 生成されるビルドのディレクトリ名 buildPlayerOptions.target = BuildTarget.WebGL; buildPlayerOptions.options = BuildOptions.None; BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions); BuildSummary summary = report.summary; if (summary.result == BuildResult.Succeeded) { Debug.Log("Build succeeded: " + summary.totalSize + " bytes"); } if (summary.result == BuildResult.Failed) { Debug.Log("Build failed"); } } }
BuildPipelineの公式マニュアル:http://docs.unity3d.com/ja/current/ScriptReference/BuildPipeline.BuildPlayer.html