Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active January 20, 2019 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unitycoder/634d3e61cbab1e15373ac87580372cca to your computer and use it in GitHub Desktop.
Save unitycoder/634d3e61cbab1e15373ac87580372cca to your computer and use it in GitHub Desktop.
Automatically switch to webgl2.0 emulation in editor start, if target platform is webgl
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public class Startup
{
static Startup()
{
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.WebGL)
{
// delay until menu is ready
EditorApplication.delayCall = () =>
{
Debug.Log("Switching Graphics Emulation to WebGL 2.0");
EditorApplication.ExecuteMenuItem("Edit/Graphics Emulation/WebGL 2.0");
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment