IMHOTEP Framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
SteamVR_Settings.cs
1 //======= Copyright (c) Valve Corporation, All rights reserved. ===============
2 //
3 // Purpose: Prompt developers to use settings most compatible with SteamVR.
4 //
5 //=============================================================================
6 
7 using UnityEngine;
8 using UnityEditor;
9 using System.IO;
10 
11 [InitializeOnLoad]
12 public class SteamVR_Settings : EditorWindow
13 {
14  const bool forceShow = false; // Set to true to get the dialog to show back up in the case you clicked Ignore All.
15 
16  const string ignore = "ignore.";
17  const string useRecommended = "Use recommended ({0})";
18  const string currentValue = " (current = {0})";
19 
20  const string buildTarget = "Build Target";
21  const string showUnitySplashScreen = "Show Unity Splashscreen";
22  const string defaultIsFullScreen = "Default is Fullscreen";
23  const string defaultScreenSize = "Default Screen Size";
24  const string runInBackground = "Run In Background";
25  const string displayResolutionDialog = "Display Resolution Dialog";
26  const string resizableWindow = "Resizable Window";
27  const string fullscreenMode = "D3D11 Fullscreen Mode";
28  const string visibleInBackground = "Visible In Background";
29 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
30  const string renderingPath = "Rendering Path";
31 #endif
32  const string colorSpace = "Color Space";
33  const string gpuSkinning = "GPU Skinning";
34 #if false // skyboxes are currently broken
35  const string singlePassStereoRendering = "Single-Pass Stereo Rendering";
36 #endif
37 
38  const BuildTarget recommended_BuildTarget = BuildTarget.StandaloneWindows64;
39  const bool recommended_ShowUnitySplashScreen = false;
40  const bool recommended_DefaultIsFullScreen = false;
41  const int recommended_DefaultScreenWidth = 1024;
42  const int recommended_DefaultScreenHeight = 768;
43  const bool recommended_RunInBackground = true;
44  const ResolutionDialogSetting recommended_DisplayResolutionDialog = ResolutionDialogSetting.HiddenByDefault;
45  const bool recommended_ResizableWindow = true;
46  const D3D11FullscreenMode recommended_FullscreenMode = D3D11FullscreenMode.FullscreenWindow;
47  const bool recommended_VisibleInBackground = true;
48 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
49  const RenderingPath recommended_RenderPath = RenderingPath.Forward;
50 #endif
51  const ColorSpace recommended_ColorSpace = ColorSpace.Linear;
52  const bool recommended_GpuSkinning = true;
53 #if false
54  const bool recommended_SinglePassStereoRendering = true;
55 #endif
56 
57  static SteamVR_Settings window;
58 
59  static SteamVR_Settings()
60  {
61  EditorApplication.update += Update;
62  }
63 
64  static void Update()
65  {
66  bool show =
67  (!EditorPrefs.HasKey(ignore + buildTarget) &&
68  EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) ||
69  (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
70 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
71  PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) ||
72 #else
73  PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) ||
74 #endif
75  (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
76  PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) ||
77  (!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
78  (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
79  PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) ||
80  (!EditorPrefs.HasKey(ignore + runInBackground) &&
81  PlayerSettings.runInBackground != recommended_RunInBackground) ||
82  (!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
83  PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) ||
84  (!EditorPrefs.HasKey(ignore + resizableWindow) &&
85  PlayerSettings.resizableWindow != recommended_ResizableWindow) ||
86  (!EditorPrefs.HasKey(ignore + fullscreenMode) &&
87  PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) ||
88  (!EditorPrefs.HasKey(ignore + visibleInBackground) &&
89  PlayerSettings.visibleInBackground != recommended_VisibleInBackground) ||
90 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
91  (!EditorPrefs.HasKey(ignore + renderingPath) &&
92  PlayerSettings.renderingPath != recommended_RenderPath) ||
93 #endif
94  (!EditorPrefs.HasKey(ignore + colorSpace) &&
95  PlayerSettings.colorSpace != recommended_ColorSpace) ||
96  (!EditorPrefs.HasKey(ignore + gpuSkinning) &&
97  PlayerSettings.gpuSkinning != recommended_GpuSkinning) ||
98 #if false
99  (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) &&
100  PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) ||
101 #endif
102  forceShow;
103 
104  if (show)
105  {
106  window = GetWindow<SteamVR_Settings>(true);
107  window.minSize = new Vector2(320, 440);
108  //window.title = "SteamVR";
109  }
110 
112  {
113  // Switch to native OpenVR support.
114  var updated = false;
115 
116  if (!PlayerSettings.virtualRealitySupported)
117  {
118  PlayerSettings.virtualRealitySupported = true;
119  updated = true;
120  }
121 
122 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
123  var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevices(BuildTargetGroup.Standalone);
124 #else
125  var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone);
126 #endif
127  var hasOpenVR = false;
128  foreach (var device in devices)
129  if (device.ToLower() == "openvr")
130  hasOpenVR = true;
131 
132 
133  if (!hasOpenVR)
134  {
135  string[] newDevices;
136  if (updated)
137  {
138  newDevices = new string[] { "OpenVR" };
139  }
140  else
141  {
142  newDevices = new string[devices.Length + 1];
143  for (int i = 0; i < devices.Length; i++)
144  newDevices[i] = devices[i];
145  newDevices[devices.Length] = "OpenVR";
146  updated = true;
147  }
148 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
149  UnityEditorInternal.VR.VREditor.SetVREnabledDevices(BuildTargetGroup.Standalone, newDevices);
150 #else
151  UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone, newDevices);
152 #endif
153  }
154 
155  if (updated)
156  Debug.Log("Switching to native OpenVR support.");
157  }
158 
159  var dlls = new string[]
160  {
161  "Plugins/x86/openvr_api.dll",
162  "Plugins/x86_64/openvr_api.dll"
163  };
164 
165  foreach (var path in dlls)
166  {
167  if (!File.Exists(Application.dataPath + "/" + path))
168  continue;
169 
170  if (AssetDatabase.DeleteAsset("Assets/" + path))
171  Debug.Log("Deleting " + path);
172  else
173  {
174  Debug.Log(path + " in use; cannot delete. Please restart Unity to complete upgrade.");
175  }
176  }
177 
178  EditorApplication.update -= Update;
179  }
180 
181  Vector2 scrollPosition;
182 
183  string GetResourcePath()
184  {
185  var ms = MonoScript.FromScriptableObject(this);
186  var path = AssetDatabase.GetAssetPath(ms);
187  path = Path.GetDirectoryName(path);
188  return path.Substring(0, path.Length - "Editor".Length) + "Textures/";
189  }
190 
191  public void OnGUI()
192  {
193  var resourcePath = GetResourcePath();
194  var logo = AssetDatabase.LoadAssetAtPath<Texture2D>(resourcePath + "logo.png");
195  var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box);
196  if (logo)
197  GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);
198 
199  EditorGUILayout.HelpBox("Recommended project settings for SteamVR:", MessageType.Warning);
200 
201  scrollPosition = GUILayout.BeginScrollView(scrollPosition);
202 
203  int numItems = 0;
204 
205  if (!EditorPrefs.HasKey(ignore + buildTarget) &&
206  EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget)
207  {
208  ++numItems;
209 
210  GUILayout.Label(buildTarget + string.Format(currentValue, EditorUserBuildSettings.activeBuildTarget));
211 
212  GUILayout.BeginHorizontal();
213 
214  if (GUILayout.Button(string.Format(useRecommended, recommended_BuildTarget)))
215  {
216 #if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
217  EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget);
218 #else
219  EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget);
220 #endif
221  }
222 
223  GUILayout.FlexibleSpace();
224 
225  if (GUILayout.Button("Ignore"))
226  {
227  EditorPrefs.SetBool(ignore + buildTarget, true);
228  }
229 
230  GUILayout.EndHorizontal();
231  }
232 
233 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
234  if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
235  PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen)
236  {
237  ++numItems;
238 
239  GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.showUnitySplashScreen));
240 
241  GUILayout.BeginHorizontal();
242 
243  if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen)))
244  {
245  PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen;
246  }
247 
248  GUILayout.FlexibleSpace();
249 
250  if (GUILayout.Button("Ignore"))
251  {
252  EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
253  }
254 
255  GUILayout.EndHorizontal();
256  }
257 #else
258  if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
259  PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen)
260  {
261  ++numItems;
262 
263  GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show));
264 
265  GUILayout.BeginHorizontal();
266 
267  if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen)))
268  {
269  PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen;
270  }
271 
272  GUILayout.FlexibleSpace();
273 
274  if (GUILayout.Button("Ignore"))
275  {
276  EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
277  }
278 
279  GUILayout.EndHorizontal();
280  }
281 #endif
282  if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
283  PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen)
284  {
285  ++numItems;
286 
287  GUILayout.Label(defaultIsFullScreen + string.Format(currentValue, PlayerSettings.defaultIsFullScreen));
288 
289  GUILayout.BeginHorizontal();
290 
291  if (GUILayout.Button(string.Format(useRecommended, recommended_DefaultIsFullScreen)))
292  {
293  PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen;
294  }
295 
296  GUILayout.FlexibleSpace();
297 
298  if (GUILayout.Button("Ignore"))
299  {
300  EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
301  }
302 
303  GUILayout.EndHorizontal();
304  }
305 
306  if (!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
307  (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
308  PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight))
309  {
310  ++numItems;
311 
312  GUILayout.Label(defaultScreenSize + string.Format(" ({0}x{1})", PlayerSettings.defaultScreenWidth, PlayerSettings.defaultScreenHeight));
313 
314  GUILayout.BeginHorizontal();
315 
316  if (GUILayout.Button(string.Format("Use recommended ({0}x{1})", recommended_DefaultScreenWidth, recommended_DefaultScreenHeight)))
317  {
318  PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth;
319  PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight;
320  }
321 
322  GUILayout.FlexibleSpace();
323 
324  if (GUILayout.Button("Ignore"))
325  {
326  EditorPrefs.SetBool(ignore + defaultScreenSize, true);
327  }
328 
329  GUILayout.EndHorizontal();
330  }
331 
332  if (!EditorPrefs.HasKey(ignore + runInBackground) &&
333  PlayerSettings.runInBackground != recommended_RunInBackground)
334  {
335  ++numItems;
336 
337  GUILayout.Label(runInBackground + string.Format(currentValue, PlayerSettings.runInBackground));
338 
339  GUILayout.BeginHorizontal();
340 
341  if (GUILayout.Button(string.Format(useRecommended, recommended_RunInBackground)))
342  {
343  PlayerSettings.runInBackground = recommended_RunInBackground;
344  }
345 
346  GUILayout.FlexibleSpace();
347 
348  if (GUILayout.Button("Ignore"))
349  {
350  EditorPrefs.SetBool(ignore + runInBackground, true);
351  }
352 
353  GUILayout.EndHorizontal();
354  }
355 
356  if (!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
357  PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog)
358  {
359  ++numItems;
360 
361  GUILayout.Label(displayResolutionDialog + string.Format(currentValue, PlayerSettings.displayResolutionDialog));
362 
363  GUILayout.BeginHorizontal();
364 
365  if (GUILayout.Button(string.Format(useRecommended, recommended_DisplayResolutionDialog)))
366  {
367  PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog;
368  }
369 
370  GUILayout.FlexibleSpace();
371 
372  if (GUILayout.Button("Ignore"))
373  {
374  EditorPrefs.SetBool(ignore + displayResolutionDialog, true);
375  }
376 
377  GUILayout.EndHorizontal();
378  }
379 
380  if (!EditorPrefs.HasKey(ignore + resizableWindow) &&
381  PlayerSettings.resizableWindow != recommended_ResizableWindow)
382  {
383  ++numItems;
384 
385  GUILayout.Label(resizableWindow + string.Format(currentValue, PlayerSettings.resizableWindow));
386 
387  GUILayout.BeginHorizontal();
388 
389  if (GUILayout.Button(string.Format(useRecommended, recommended_ResizableWindow)))
390  {
391  PlayerSettings.resizableWindow = recommended_ResizableWindow;
392  }
393 
394  GUILayout.FlexibleSpace();
395 
396  if (GUILayout.Button("Ignore"))
397  {
398  EditorPrefs.SetBool(ignore + resizableWindow, true);
399  }
400 
401  GUILayout.EndHorizontal();
402  }
403 
404  if (!EditorPrefs.HasKey(ignore + fullscreenMode) &&
405  PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode)
406  {
407  ++numItems;
408 
409  GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.d3d11FullscreenMode));
410 
411  GUILayout.BeginHorizontal();
412 
413  if (GUILayout.Button(string.Format(useRecommended, recommended_FullscreenMode)))
414  {
415  PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode;
416  }
417 
418  GUILayout.FlexibleSpace();
419 
420  if (GUILayout.Button("Ignore"))
421  {
422  EditorPrefs.SetBool(ignore + fullscreenMode, true);
423  }
424 
425  GUILayout.EndHorizontal();
426  }
427 
428  if (!EditorPrefs.HasKey(ignore + visibleInBackground) &&
429  PlayerSettings.visibleInBackground != recommended_VisibleInBackground)
430  {
431  ++numItems;
432 
433  GUILayout.Label(visibleInBackground + string.Format(currentValue, PlayerSettings.visibleInBackground));
434 
435  GUILayout.BeginHorizontal();
436 
437  if (GUILayout.Button(string.Format(useRecommended, recommended_VisibleInBackground)))
438  {
439  PlayerSettings.visibleInBackground = recommended_VisibleInBackground;
440  }
441 
442  GUILayout.FlexibleSpace();
443 
444  if (GUILayout.Button("Ignore"))
445  {
446  EditorPrefs.SetBool(ignore + visibleInBackground, true);
447  }
448 
449  GUILayout.EndHorizontal();
450  }
451 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
452  if (!EditorPrefs.HasKey(ignore + renderingPath) &&
453  PlayerSettings.renderingPath != recommended_RenderPath)
454  {
455  ++numItems;
456 
457  GUILayout.Label(renderingPath + string.Format(currentValue, PlayerSettings.renderingPath));
458 
459  GUILayout.BeginHorizontal();
460 
461  if (GUILayout.Button(string.Format(useRecommended, recommended_RenderPath) + " - required for MSAA"))
462  {
463  PlayerSettings.renderingPath = recommended_RenderPath;
464  }
465 
466  GUILayout.FlexibleSpace();
467 
468  if (GUILayout.Button("Ignore"))
469  {
470  EditorPrefs.SetBool(ignore + renderingPath, true);
471  }
472 
473  GUILayout.EndHorizontal();
474  }
475 #endif
476  if (!EditorPrefs.HasKey(ignore + colorSpace) &&
477  PlayerSettings.colorSpace != recommended_ColorSpace)
478  {
479  ++numItems;
480 
481  GUILayout.Label(colorSpace + string.Format(currentValue, PlayerSettings.colorSpace));
482 
483  GUILayout.BeginHorizontal();
484 
485  if (GUILayout.Button(string.Format(useRecommended, recommended_ColorSpace) + " - requires reloading scene"))
486  {
487  PlayerSettings.colorSpace = recommended_ColorSpace;
488  }
489 
490  GUILayout.FlexibleSpace();
491 
492  if (GUILayout.Button("Ignore"))
493  {
494  EditorPrefs.SetBool(ignore + colorSpace, true);
495  }
496 
497  GUILayout.EndHorizontal();
498  }
499 
500  if (!EditorPrefs.HasKey(ignore + gpuSkinning) &&
501  PlayerSettings.gpuSkinning != recommended_GpuSkinning)
502  {
503  ++numItems;
504 
505  GUILayout.Label(gpuSkinning + string.Format(currentValue, PlayerSettings.gpuSkinning));
506 
507  GUILayout.BeginHorizontal();
508 
509  if (GUILayout.Button(string.Format(useRecommended, recommended_GpuSkinning)))
510  {
511  PlayerSettings.gpuSkinning = recommended_GpuSkinning;
512  }
513 
514  GUILayout.FlexibleSpace();
515 
516  if (GUILayout.Button("Ignore"))
517  {
518  EditorPrefs.SetBool(ignore + gpuSkinning, true);
519  }
520 
521  GUILayout.EndHorizontal();
522  }
523 
524 #if false
525  if (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) &&
526  PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering)
527  {
528  ++numItems;
529 
530  GUILayout.Label(singlePassStereoRendering + string.Format(currentValue, PlayerSettings.singlePassStereoRendering));
531 
532  GUILayout.BeginHorizontal();
533 
534  if (GUILayout.Button(string.Format(useRecommended, recommended_SinglePassStereoRendering)))
535  {
536  PlayerSettings.singlePassStereoRendering = recommended_SinglePassStereoRendering;
537  }
538 
539  GUILayout.FlexibleSpace();
540 
541  if (GUILayout.Button("Ignore"))
542  {
543  EditorPrefs.SetBool(ignore + singlePassStereoRendering, true);
544  }
545 
546  GUILayout.EndHorizontal();
547  }
548 #endif
549 
550  GUILayout.BeginHorizontal();
551 
552  GUILayout.FlexibleSpace();
553 
554  if (GUILayout.Button("Clear All Ignores"))
555  {
556  EditorPrefs.DeleteKey(ignore + buildTarget);
557  EditorPrefs.DeleteKey(ignore + showUnitySplashScreen);
558  EditorPrefs.DeleteKey(ignore + defaultIsFullScreen);
559  EditorPrefs.DeleteKey(ignore + defaultScreenSize);
560  EditorPrefs.DeleteKey(ignore + runInBackground);
561  EditorPrefs.DeleteKey(ignore + displayResolutionDialog);
562  EditorPrefs.DeleteKey(ignore + resizableWindow);
563  EditorPrefs.DeleteKey(ignore + fullscreenMode);
564  EditorPrefs.DeleteKey(ignore + visibleInBackground);
565 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
566  EditorPrefs.DeleteKey(ignore + renderingPath);
567 #endif
568  EditorPrefs.DeleteKey(ignore + colorSpace);
569  EditorPrefs.DeleteKey(ignore + gpuSkinning);
570 #if false
571  EditorPrefs.DeleteKey(ignore + singlePassStereoRendering);
572 #endif
573  }
574 
575  GUILayout.EndHorizontal();
576 
577  GUILayout.EndScrollView();
578 
579  GUILayout.FlexibleSpace();
580 
581  GUILayout.BeginHorizontal();
582 
583  if (numItems > 0)
584  {
585  if (GUILayout.Button("Accept All"))
586  {
587  // Only set those that have not been explicitly ignored.
588  if (!EditorPrefs.HasKey(ignore + buildTarget))
589 #if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
590  EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget);
591 #else
592  EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget);
593 #endif
594  if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen))
595 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
596  PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen;
597 #else
598  PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen;
599 #endif
600  if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen))
601  PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen;
602  if (!EditorPrefs.HasKey(ignore + defaultScreenSize))
603  {
604  PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth;
605  PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight;
606  }
607  if (!EditorPrefs.HasKey(ignore + runInBackground))
608  PlayerSettings.runInBackground = recommended_RunInBackground;
609  if (!EditorPrefs.HasKey(ignore + displayResolutionDialog))
610  PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog;
611  if (!EditorPrefs.HasKey(ignore + resizableWindow))
612  PlayerSettings.resizableWindow = recommended_ResizableWindow;
613  if (!EditorPrefs.HasKey(ignore + fullscreenMode))
614  PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode;
615  if (!EditorPrefs.HasKey(ignore + visibleInBackground))
616  PlayerSettings.visibleInBackground = recommended_VisibleInBackground;
617 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
618  if (!EditorPrefs.HasKey(ignore + renderingPath))
619  PlayerSettings.renderingPath = recommended_RenderPath;
620 #endif
621  if (!EditorPrefs.HasKey(ignore + colorSpace))
622  PlayerSettings.colorSpace = recommended_ColorSpace;
623  if (!EditorPrefs.HasKey(ignore + gpuSkinning))
624  PlayerSettings.gpuSkinning = recommended_GpuSkinning;
625 #if false
626  if (!EditorPrefs.HasKey(ignore + singlePassStereoRendering))
627  PlayerSettings.singlePassStereoRendering = recommended_SinglePassStereoRendering;
628 #endif
629 
630  EditorUtility.DisplayDialog("Accept All", "You made the right choice!", "Ok");
631 
632  Close();
633  }
634 
635  if (GUILayout.Button("Ignore All"))
636  {
637  if (EditorUtility.DisplayDialog("Ignore All", "Are you sure?", "Yes, Ignore All", "Cancel"))
638  {
639  // Only ignore those that do not currently match our recommended settings.
640  if (EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget)
641  EditorPrefs.SetBool(ignore + buildTarget, true);
642 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
643  if (PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen)
644 #else
645  if (PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen)
646 #endif
647  EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
648  if (PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen)
649  EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
650  if (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
651  PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)
652  EditorPrefs.SetBool(ignore + defaultScreenSize, true);
653  if (PlayerSettings.runInBackground != recommended_RunInBackground)
654  EditorPrefs.SetBool(ignore + runInBackground, true);
655  if (PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog)
656  EditorPrefs.SetBool(ignore + displayResolutionDialog, true);
657  if (PlayerSettings.resizableWindow != recommended_ResizableWindow)
658  EditorPrefs.SetBool(ignore + resizableWindow, true);
659  if (PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode)
660  EditorPrefs.SetBool(ignore + fullscreenMode, true);
661  if (PlayerSettings.visibleInBackground != recommended_VisibleInBackground)
662  EditorPrefs.SetBool(ignore + visibleInBackground, true);
663 #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
664  if (PlayerSettings.renderingPath != recommended_RenderPath)
665  EditorPrefs.SetBool(ignore + renderingPath, true);
666 #endif
667  if (PlayerSettings.colorSpace != recommended_ColorSpace)
668  EditorPrefs.SetBool(ignore + colorSpace, true);
669  if (PlayerSettings.gpuSkinning != recommended_GpuSkinning)
670  EditorPrefs.SetBool(ignore + gpuSkinning, true);
671 #if false
672  if (PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering)
673  EditorPrefs.SetBool(ignore + singlePassStereoRendering, true);
674 #endif
675 
676  Close();
677  }
678  }
679  }
680  else if (GUILayout.Button("Close"))
681  {
682  Close();
683  }
684 
685  GUILayout.EndHorizontal();
686  }
687 }
688 
static bool AutoEnableVR
Should SteamVR automatically enable VR when opening Unity or pressing play.