@@ -21,16 +21,15 @@ public enum ProjectSetting
2121 BuildWsaUwp ,
2222 WsaUwpBuildToD3D ,
2323 WsaFastestQuality ,
24- WsaEnableVR ,
25- SharingServices
24+ WsaEnableVR
2625 }
2726 #endregion // Nested Types
2827
2928 #region Internal Methods
3029 /// <summary>
3130 /// Enables virtual reality for WSA and ensures HoloLens is in the supported SDKs.
3231 /// </summary>
33- private static void EnableVirtualReality ( )
32+ private void EnableVirtualReality ( )
3433 {
3534 try
3635 {
@@ -78,7 +77,7 @@ private static void EnableVirtualReality()
7877 }
7978 else
8079 {
81- // The target VR settings were found but the others
80+ // The target VR settngs were found but the others
8281 // still need to be searched for.
8382 foundBuildTargetVRSettings = true ;
8483 }
@@ -120,12 +119,12 @@ private static void EnableVirtualReality()
120119 // If this isn't an element in the device list
121120 if ( ! line . Contains ( "-" ) )
122121 {
123- // add the HoloLens element, and mark it found
122+ // add the hololens element, and mark it found
124123 builder . Append ( " - HoloLens\n " ) ;
125124 foundHoloLens = true ;
126125 }
127126
128- // Otherwise test if this is the HoloLens device
127+ // Otherwise test if this is the hololens device
129128 else if ( line . Contains ( "HoloLens" ) )
130129 {
131130 foundHoloLens = true ;
@@ -156,7 +155,7 @@ private static void EnableVirtualReality()
156155 /// <summary>
157156 /// Modifies the WSA default quality setting to the fastest
158157 /// </summary>
159- private static void SetFastestDefaultQuality ( )
158+ private void SetFastestDefaultQuality ( )
160159 {
161160 try
162161 {
@@ -180,44 +179,46 @@ private static void SetFastestDefaultQuality()
180179 #region Overrides / Event Handlers
181180 protected override void ApplySettings ( )
182181 {
182+ // See the blow notes for why text asset serialization is required
183+ if ( EditorSettings . serializationMode != SerializationMode . ForceText )
184+ {
185+ // NOTE: PlayerSettings.virtualRealitySupported would be ideal, except that it only reports/affects whatever platform tab
186+ // is currently selected in the Player settings window. As we don't have code control over what view is selected there
187+ // this property is fairly useless from script.
188+
189+ // NOTE: There is no current way to change the default quality setting from script
190+
191+ string dialogTitle = "Updates require text serialization of assets" ;
192+ string message = "Unity doesn't provide apis for updating the default quality or enabling VR support.\n \n " +
193+ "Is it ok if we force text serialization of assets so that we can modify the properties directly?" ;
194+
195+ bool forceText = EditorUtility . DisplayDialog ( dialogTitle , message , "Yes" , "No" ) ;
196+ if ( ! forceText )
197+ {
198+ return ;
199+ }
200+
201+ EditorSettings . serializationMode = SerializationMode . ForceText ;
202+ }
203+
183204 // Apply individual settings
184205 if ( Values [ ProjectSetting . BuildWsaUwp ] )
185206 {
186207 EditorUserBuildSettings . SwitchActiveBuildTarget ( BuildTargetGroup . WSA , BuildTarget . WSAPlayer ) ;
187208 }
188-
189209 if ( Values [ ProjectSetting . WsaUwpBuildToD3D ] )
190210 {
191211 EditorUserBuildSettings . wsaUWPBuildType = WSAUWPBuildType . D3D ;
192212 }
193-
194213 if ( Values [ ProjectSetting . WsaFastestQuality ] )
195214 {
196215 SetFastestDefaultQuality ( ) ;
197216 }
198-
199217 if ( Values [ ProjectSetting . WsaEnableVR ] )
200218 {
201219 EnableVirtualReality ( ) ;
202220 }
203221
204- if ( Values [ ProjectSetting . SharingServices ] )
205- {
206- PlayerSettings . WSA . SetCapability ( PlayerSettings . WSACapability . Microphone , true ) ;
207- PlayerSettings . WSA . SetCapability ( PlayerSettings . WSACapability . InternetClient , true ) ;
208- PlayerSettings . WSA . SetCapability ( PlayerSettings . WSACapability . SpatialPerception , true ) ;
209- PlayerSettings . WSA . SetCapability ( PlayerSettings . WSACapability . InternetClientServer , true ) ;
210- PlayerSettings . WSA . SetCapability ( PlayerSettings . WSACapability . PrivateNetworkClientServer , true ) ;
211- }
212- else
213- {
214- PlayerSettings . WSA . SetCapability ( PlayerSettings . WSACapability . Microphone , false ) ;
215- PlayerSettings . WSA . SetCapability ( PlayerSettings . WSACapability . InternetClient , false ) ;
216- PlayerSettings . WSA . SetCapability ( PlayerSettings . WSACapability . SpatialPerception , false ) ;
217- PlayerSettings . WSA . SetCapability ( PlayerSettings . WSACapability . InternetClientServer , false ) ;
218- PlayerSettings . WSA . SetCapability ( PlayerSettings . WSACapability . PrivateNetworkClientServer , false ) ;
219- }
220-
221222 // Since we went behind Unity's back to tweak some settings we
222223 // need to reload the project to have them take effect
223224 bool canReload = EditorUtility . DisplayDialog (
@@ -234,7 +235,7 @@ protected override void ApplySettings()
234235
235236 protected override void LoadSettings ( )
236237 {
237- for ( int i = ( int ) ProjectSetting . BuildWsaUwp ; i <= ( int ) ProjectSetting . SharingServices ; i ++ )
238+ for ( int i = ( int ) ProjectSetting . BuildWsaUwp ; i <= ( int ) ProjectSetting . WsaEnableVR ; i ++ )
238239 {
239240 Values [ ( ProjectSetting ) i ] = true ;
240241 }
@@ -253,11 +254,6 @@ protected override void LoadStrings()
253254
254255 Names [ ProjectSetting . WsaEnableVR ] = "Enable VR" ;
255256 Descriptions [ ProjectSetting . WsaEnableVR ] = "Required\n \n Enables VR for Windows Store apps and adds the HoloLens as a target VR device.\n \n The application will not compile for HoloLens and tools like Holographic Remoting will not function without this enabled. Therefore this option should remain checked unless you plan to manually perform these steps later." ;
256-
257- Names [ ProjectSetting . SharingServices ] = "Enable Sharing Services" ;
258- Descriptions [ ProjectSetting . SharingServices ] = "Enables the use of the Sharing Services in your project.\n \n " +
259- "Requires the SpatialPerception, InternetClient, InternetClientServer, PrivateNetworkClientServer, and Microphone Capabilities.\n \n " +
260- "Start the Sharing Server though HoloToolkit->Sharing Service->Launch Sharing Service." ;
261257 }
262258
263259 protected override void OnEnable ( )
@@ -266,7 +262,7 @@ protected override void OnEnable()
266262 base . OnEnable ( ) ;
267263
268264 // Set size
269- minSize = new Vector2 ( 350 , 350 ) ;
265+ minSize = new Vector2 ( 350 , 260 ) ;
270266 maxSize = minSize ;
271267 }
272268 #endregion // Overrides / Event Handlers
0 commit comments