Hello!
I cannot figure out how to set/unset Use pre-built Engine from script. When this option is set, the build process throws an exception:
Exception: 'Pre-built engine' option is not supported for WebAssembly. In order to build disable 'Use pre-built Engine' or enable Asm.js linker target in Player Settings.
This is the code so far:
[MenuItem("Build/WebAssembly only &w")]
public static void BuildWebAssemblyOnly()
{
if(BuildPipeline.isBuildingPlayer)
return;
// collect open scenes in hierarchie
var c = SceneManager.sceneCount;
var scenes = new string
;
for(var i = 0; i<c; i++)
scenes* = SceneManager.GetSceneAt(i).path;
// backup player settings
var linkerTarget = PlayerSettings.WebGL.linkerTarget;
var nameHashes = PlayerSettings.WebGL.nameFilesAsHashes = true;
var splashShow = PlayerSettings.SplashScreen.show;
// settings for current build process
PlayerSettings.WebGL.linkerTarget = WebGLLinkerTarget.Wasm;
PlayerSettings.WebGL.nameFilesAsHashes = true;
PlayerSettings.SplashScreen.show = false;
// build
var buildOptions = BuildOptions.AllowDebugging | BuildOptions.Development | BuildOptions.StrictMode;
BuildPipeline.BuildPlayer(scenes, targetPath, BuildTarget.WebGL, buildOptions);
// restore player settings
PlayerSettings.WebGL.linkerTarget = linkerTarget;
PlayerSettings.WebGL.nameFilesAsHashes = nameHashes;
PlayerSettings.SplashScreen.show = splashShow;
}
I dislike having to set this option manually. Is there any way to ensure by script, this option is turned off for the build process?