@@ -21,15 +21,16 @@ public enum ProjectSetting
2121 BuildWsaUwp ,
2222 WsaUwpBuildToD3D ,
2323 WsaFastestQuality ,
24- WsaEnableVR
24+ WsaEnableVR ,
25+ SharingServices
2526 }
2627 #endregion // Nested Types
2728
2829 #region Internal Methods
2930 /// <summary>
3031 /// Enables virtual reality for WSA and ensures HoloLens is in the supported SDKs.
3132 /// </summary>
32- private void EnableVirtualReality ( )
33+ private static void EnableVirtualReality ( )
3334 {
3435 try
3536 {
@@ -77,7 +78,7 @@ private void EnableVirtualReality()
7778 }
7879 else
7980 {
80- // The target VR settngs were found but the others
81+ // The target VR settings were found but the others
8182 // still need to be searched for.
8283 foundBuildTargetVRSettings = true ;
8384 }
@@ -119,12 +120,12 @@ private void EnableVirtualReality()
119120 // If this isn't an element in the device list
120121 if ( ! line . Contains ( "-" ) )
121122 {
122- // add the hololens element, and mark it found
123+ // add the HoloLens element, and mark it found
123124 builder . Append ( " - HoloLens\n " ) ;
124125 foundHoloLens = true ;
125126 }
126127
127- // Otherwise test if this is the hololens device
128+ // Otherwise test if this is the HoloLens device
128129 else if ( line . Contains ( "HoloLens" ) )
129130 {
130131 foundHoloLens = true ;
@@ -155,7 +156,7 @@ private void EnableVirtualReality()
155156 /// <summary>
156157 /// Modifies the WSA default quality setting to the fastest
157158 /// </summary>
158- private void SetFastestDefaultQuality ( )
159+ private static void SetFastestDefaultQuality ( )
159160 {
160161 try
161162 {
@@ -179,46 +180,44 @@ private void SetFastestDefaultQuality()
179180 #region Overrides / Event Handlers
180181 protected override void ApplySettings ( )
181182 {
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-
204183 // Apply individual settings
205184 if ( Values [ ProjectSetting . BuildWsaUwp ] )
206185 {
207186 EditorUserBuildSettings . SwitchActiveBuildTarget ( BuildTargetGroup . WSA , BuildTarget . WSAPlayer ) ;
208187 }
188+
209189 if ( Values [ ProjectSetting . WsaUwpBuildToD3D ] )
210190 {
211191 EditorUserBuildSettings . wsaUWPBuildType = WSAUWPBuildType . D3D ;
212192 }
193+
213194 if ( Values [ ProjectSetting . WsaFastestQuality ] )
214195 {
215196 SetFastestDefaultQuality ( ) ;
216197 }
198+
217199 if ( Values [ ProjectSetting . WsaEnableVR ] )
218200 {
219201 EnableVirtualReality ( ) ;
220202 }
221203
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+
222221 // Since we went behind Unity's back to tweak some settings we
223222 // need to reload the project to have them take effect
224223 bool canReload = EditorUtility . DisplayDialog (
@@ -235,7 +234,7 @@ protected override void ApplySettings()
235234
236235 protected override void LoadSettings ( )
237236 {
238- for ( int i = ( int ) ProjectSetting . BuildWsaUwp ; i <= ( int ) ProjectSetting . WsaEnableVR ; i ++ )
237+ for ( int i = ( int ) ProjectSetting . BuildWsaUwp ; i <= ( int ) ProjectSetting . SharingServices ; i ++ )
239238 {
240239 Values [ ( ProjectSetting ) i ] = true ;
241240 }
@@ -254,6 +253,11 @@ protected override void LoadStrings()
254253
255254 Names [ ProjectSetting . WsaEnableVR ] = "Enable VR" ;
256255 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." ;
257261 }
258262
259263 protected override void OnEnable ( )
@@ -262,7 +266,7 @@ protected override void OnEnable()
262266 base . OnEnable ( ) ;
263267
264268 // Set size
265- minSize = new Vector2 ( 350 , 260 ) ;
269+ minSize = new Vector2 ( 350 , 350 ) ;
266270 maxSize = minSize ;
267271 }
268272 #endregion // Overrides / Event Handlers
0 commit comments