- Home /
Set Graphics Emulation to No Emulation as Default?
How do I set my Graphics Emulation to No Emulation as its default state? Since it changes back to OpenGL ES when I restart Unity.
I've tried:
 using UnityEngine;
 using UnityEditor;
  
 [InitializeOnLoad]
 public class Watchtower
 {
     static Watchtower()
     {
         Debug.Log("Watchtower");
         EditorApplication.ExecuteMenuItem("Edit/Graphics Emulation/No Emulation");
     }
 }
But it gives me this error:
 ExecuteMenuItem failed because there is no menu named 'Edit/Graphics Emulation/No Emulation'
Thanks!
It works in my editor every time. Once it hit play, emulation is set from one of the shaders i selected before hitting play back to No Emulation. This was against 4.3.4f1, I even commented out the line that executed the menu item and then no affect carried between edit and play mode.
What version of Unity are you using?
Answer by hu_amao · Dec 31, 2014 at 01:13 PM
Same question and still dont't know why, alternative solution below is ok in 4.6.0, hope it helps.
 using UnityEngine;
 using UnityEditor;
 
 [InitializeOnLoad]
 
 public class EditInitialSetting
 {
     static EditInitialSetting()
     {
         EditorApplication.update += Update;
     }
 
     static void Update()
     {
         bool isSuccess = EditorApplication.ExecuteMenuItem("Edit/Graphics Emulation/No Emulation");
         if (isSuccess)
             EditorApplication.update -= Update;
     }
 }
@hu_amao That is an amazing piece of code! It does work ! Albeith while building, this doesnt build for android. ..it gives an error: The name 'EditorApplication' doesnt exist in the current context.....:(
This is an editor script and has to be placed in a folder named "editor" inside your Assets folder.
Answer by Stardog · Mar 01, 2019 at 08:43 PM
Here is another one for automatically setting the Graphics Emulation to WebGL 2.0:
 using UnityEngine;
 using UnityEditor;
 
 [InitializeOnLoad]
 public class EditorGraphicsEmulationOnStart
 {
     static EditorGraphicsEmulationOnStart()
     {
         EditorApplication.delayCall = () =>
         {
             EditorApplication.ExecuteMenuItem("Edit/Graphics Emulation/WebGL 2.0");
         };
     }
 }
Your answer
 
 
             Follow this Question
Related Questions
Unity 3.5 Error 1 Answer
What do I do if I cannot run "unity" because of the error "failed to initialize unity graphics"? 0 Answers
Unity Script Editor Not Working 1 Answer
A node in a childnode? 1 Answer
Unity Editor getThreadContext failed 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                