@@ -21,6 +21,8 @@ public class UXFWizard : EditorWindow
2121
2222 static string version ;
2323
24+ Vector2 scrollPos ;
25+
2426 static UXFWizard ( )
2527 {
2628#if UNITY_2018_1_OR_NEWER
@@ -35,11 +37,10 @@ static UXFWizard()
3537 static void Init ( )
3638 {
3739 var window = ( UXFWizard ) EditorWindow . GetWindow ( typeof ( UXFWizard ) , false , "UXF Wizard" ) ;
38- window . minSize = new Vector2 ( 300 , 501 ) ;
40+ window . minSize = new Vector2 ( 300 , 785 ) ;
3941 window . titleContent = new GUIContent ( "UXF Wizard" ) ;
4042 window . Show ( ) ;
4143
42-
4344 if ( File . Exists ( "Assets/UXF/VERSION.txt" ) )
4445 {
4546 version = File . ReadAllText ( "Assets/UXF/VERSION.txt" ) ;
@@ -72,13 +73,18 @@ static void OnProjectChanged()
7273
7374 public void OnGUI ( )
7475 {
76+ scrollPos = EditorGUILayout . BeginScrollView ( scrollPos , false , false ) ;
7577 GUIStyle labelStyle = new GUIStyle ( EditorStyles . label ) ;
7678 labelStyle . wordWrap = true ;
77-
78- var rect = GUILayoutUtility . GetRect ( Screen . width , 128 , GUI . skin . box ) ;
79+
80+ GUILayout . BeginHorizontal ( ) ;
81+ GUILayout . FlexibleSpace ( ) ;
82+ var rect = GUILayoutUtility . GetRect ( 128 , 128 , GUI . skin . box ) ;
7983 if ( uxfIcon )
8084 GUI . DrawTexture ( rect , uxfIcon , ScaleMode . ScaleToFit ) ;
81-
85+ GUILayout . FlexibleSpace ( ) ;
86+ GUILayout . EndHorizontal ( ) ;
87+
8288 GUILayout . BeginHorizontal ( ) ;
8389 GUILayout . FlexibleSpace ( ) ;
8490 GUILayout . Label ( "UXF: Unity Experiment Framework" , EditorStyles . boldLabel ) ;
@@ -93,6 +99,16 @@ public void OnGUI()
9399
94100 EditorGUILayout . Separator ( ) ;
95101
102+ GUILayout . Label ( "Platform selector" , EditorStyles . boldLabel ) ;
103+ EditorGUILayout . HelpBox ( "Click the buttons below to switch to your desired output platform. You will also need to select the Data Handler(s) you wish to use in your UXF Session Component." , MessageType . Info ) ;
104+
105+ if ( GUILayout . Button ( "Select Windows / PC VR" ) ) SetSettingsWindows ( ) ;
106+ if ( GUILayout . Button ( "Select Web Browser" ) ) SetSettingsWebGL ( ) ;
107+ if ( GUILayout . Button ( "Select Android VR (e.g. Oculus Quest)" ) ) SetSettingsOculus ( ) ;
108+ if ( GUILayout . Button ( "Select Android" ) ) SetSettingsAndroid ( ) ;
109+
110+ EditorGUILayout . Separator ( ) ;
111+
96112 GUILayout . Label ( "Help and info" , EditorStyles . boldLabel ) ;
97113
98114 GUILayout . Label ( "The GitHub page contains the most up-to-date information & release." , labelStyle ) ;
@@ -108,7 +124,6 @@ public void OnGUI()
108124 EditorGUILayout . Separator ( ) ;
109125
110126 GUILayout . Label ( "Examples" , EditorStyles . boldLabel ) ;
111-
112127 GUILayout . Label ( "Check your Assets > UXF > Examples folder" , labelStyle ) ;
113128
114129 EditorGUILayout . Separator ( ) ;
@@ -137,7 +152,6 @@ public void OnGUI()
137152 }
138153 }
139154
140-
141155 EditorGUILayout . Separator ( ) ;
142156
143157 GUILayout . Label ( "WebGL" , EditorStyles . boldLabel ) ;
@@ -163,10 +177,83 @@ public void OnGUI()
163177 }
164178 }
165179
166-
167180 EditorGUILayout . Separator ( ) ;
168181 EditorGUILayout . HelpBox ( "To show this window again go to UXF -> Show setup wizard in the menubar." , MessageType . None ) ;
182+
183+ EditorGUILayout . EndScrollView ( ) ;
184+ }
185+
186+ private static void SetSettingsWindows ( )
187+ {
188+ EditorUserBuildSettings . SwitchActiveBuildTarget ( BuildTargetGroup . Standalone , BuildTarget . StandaloneWindows64 ) ;
189+ Utilities . UXFDebugLog ( "Setup for Windows/PCVR." ) ;
190+ }
169191
192+ private static void SetSettingsWebGL ( )
193+ {
194+ string expected ;
195+ #if UNITY_2020_1_OR_NEWER
196+ expected = "PROJECT:UXF WebGL 2020" ;
197+ #else
198+ expected = "PROJECT:UXF WebGL 2019" ;
199+ #endif
200+ EditorUserBuildSettings . SwitchActiveBuildTarget ( BuildTargetGroup . WebGL , BuildTarget . WebGL ) ;
201+ PlayerSettings . WebGL . template = expected ;
202+ Utilities . UXFDebugLog ( "Setup for WebGL." ) ;
203+ }
204+
205+ private static void SetSettingsAndroid ( )
206+ {
207+ // Switch to Android build.
208+ EditorUserBuildSettings . SwitchActiveBuildTarget ( BuildTargetGroup . Android , BuildTarget . Android ) ;
209+
210+ // If the current build target is Android, then set the write permission to external
211+ if ( EditorUserBuildSettings . activeBuildTarget == BuildTarget . Android )
212+ {
213+ // Changes Android write permission to external
214+ PlayerSettings . Android . forceSDCardPermission = true ;
215+
216+ // Sets the Texture Compression to Default (Don't override)
217+ EditorUserBuildSettings . androidBuildSubtarget = MobileTextureSubtarget . Generic ;
218+
219+ Utilities . UXFDebugLog ( "Setup for Android." ) ;
220+ }
221+
222+ // If the build target was not set to Android (it may not be available on the system)
223+ else
224+ {
225+ Utilities . UXFDebugLog ( "Android build was not set, check if it is available. If it isn't, add it to the Unity Editor version via the Unity Hub." ) ;
226+ }
227+ }
228+
229+ private static void SetSettingsOculus ( )
230+ {
231+ // Switch to Android build.
232+ EditorUserBuildSettings . SwitchActiveBuildTarget ( BuildTargetGroup . Android , BuildTarget . Android ) ;
233+
234+ // If the current build target is Android, then set the write permission to external, and configure API levels and Texture compression
235+ if ( EditorUserBuildSettings . activeBuildTarget == BuildTarget . Android )
236+ {
237+ // Changes Android write permission to external
238+ PlayerSettings . Android . forceSDCardPermission = true ;
239+
240+ // Sets the Android API Level to 26
241+ PlayerSettings . Android . minSdkVersion = AndroidSdkVersions . AndroidApiLevel26 ;
242+
243+ // Sets the Android API Level to Automatic (highest installed)
244+ PlayerSettings . Android . targetSdkVersion = AndroidSdkVersions . AndroidApiLevelAuto ;
245+
246+ // Sets the Texture Compression to ASTC
247+ EditorUserBuildSettings . androidBuildSubtarget = MobileTextureSubtarget . ASTC ;
248+
249+ Utilities . UXFDebugLog ( "Setup for Android VR System (e.g. Oculus Quest)." ) ;
250+ }
251+
252+ // If the build target was not set to Android (it may not be available on the system)
253+ else
254+ {
255+ Utilities . UXFDebugLog ( "Android build was not set, check if it is available. If it isn't, add it to the Unity Editor version via the Unity Hub." ) ;
256+ }
170257 }
171258
172259 }
0 commit comments