Last active
January 20, 2019 12:45
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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