@@ -159,6 +159,24 @@ private static void InitializeSettins()
159159 // recommendedValue = true,
160160 //});
161161
162+ s_settings . Add ( new RecommendedSetting < BuildTarget > ( )
163+ {
164+ settingTitle = "Build Target" ,
165+ skipCheckFunc = ( ) => VRModule . isSteamVRPluginDetected || VIUSettingsEditor . activeBuildTargetGroup == BuildTargetGroup . Standalone || VIUSettingsEditor . activeBuildTargetGroup == BuildTargetGroup . Android ,
166+ currentValueFunc = ( ) => EditorUserBuildSettings . activeBuildTarget ,
167+ setValueFunc = v =>
168+ {
169+ #if UNITY_2017_1_OR_NEWER
170+ EditorUserBuildSettings . SwitchActiveBuildTargetAsync ( BuildTargetGroup . Standalone , BuildTarget . StandaloneWindows64 ) ;
171+ #elif UNITY_5_6_OR_NEWER
172+ EditorUserBuildSettings . SwitchActiveBuildTarget ( BuildTargetGroup . Standalone , BuildTarget . StandaloneWindows64 ) ;
173+ #else
174+ EditorUserBuildSettings . SwitchActiveBuildTarget ( BuildTarget . StandaloneWindows64 ) ;
175+ #endif
176+ } ,
177+ recommendedValue = BuildTarget . StandaloneWindows64 ,
178+ } ) ;
179+
162180 s_settings . Add ( new RecommendedSetting < bool > ( )
163181 {
164182 settingTitle = "Load Binding Config on Start" ,
@@ -384,11 +402,11 @@ private static void CheckVersionAndSettings()
384402 return ;
385403 }
386404
405+ // On Windows, PlaterSetting is stored at \HKEY_CURRENT_USER\Software\Unity Technologies\Unity Editor 5.x
406+ EditorPrefs . SetString ( nextVersionCheckTimeKey , UtcDateTimeToStr ( DateTime . UtcNow . AddMinutes ( versionCheckIntervalMinutes ) ) ) ;
407+
387408 if ( UrlSuccess ( www ) )
388409 {
389- // On Windows, PlaterSetting is stored at \HKEY_CURRENT_USER\Software\Unity Technologies\Unity Editor 5.x
390- EditorPrefs . SetString ( nextVersionCheckTimeKey , UtcDateTimeToStr ( DateTime . UtcNow . AddMinutes ( versionCheckIntervalMinutes ) ) ) ;
391-
392410 latestRepoInfo = JsonUtility . FromJson < RepoInfo > ( www . text ) ;
393411 }
394412
@@ -468,35 +486,46 @@ private static string UtcDateTimeToStr(DateTime utcDateTime)
468486
469487 private static bool UrlSuccess ( WWW www )
470488 {
471- if ( ! string . IsNullOrEmpty ( www . error ) )
489+ try
472490 {
473- // API rate limit exceeded, see https://developer.github.com/v3/#rate-limiting
474- Debug . Log ( "url:" + www . url ) ;
475- Debug . Log ( "error:" + www . error ) ;
476- Debug . Log ( www . text ) ;
477-
478- string responseHeader ;
479- if ( www . responseHeaders . TryGetValue ( "X-RateLimit-Limit" , out responseHeader ) )
491+ if ( ! string . IsNullOrEmpty ( www . error ) )
480492 {
481- Debug . Log ( "X-RateLimit-Limit:" + responseHeader ) ;
482- }
483- if ( www . responseHeaders . TryGetValue ( "X-RateLimit-Remaining" , out responseHeader ) )
484- {
485- Debug . Log ( "X-RateLimit-Remaining:" + responseHeader ) ;
493+ // API rate limit exceeded, see https://developer.github.com/v3/#rate-limiting
494+ Debug . Log ( "url:" + www . url ) ;
495+ Debug . Log ( "error:" + www . error ) ;
496+ Debug . Log ( www . text ) ;
497+
498+ if ( www . responseHeaders != null )
499+ {
500+ string responseHeader ;
501+ if ( www . responseHeaders . TryGetValue ( "X-RateLimit-Limit" , out responseHeader ) )
502+ {
503+ Debug . Log ( "X-RateLimit-Limit:" + responseHeader ) ;
504+ }
505+ if ( www . responseHeaders . TryGetValue ( "X-RateLimit-Remaining" , out responseHeader ) )
506+ {
507+ Debug . Log ( "X-RateLimit-Remaining:" + responseHeader ) ;
508+ }
509+ if ( www . responseHeaders . TryGetValue ( "X-RateLimit-Reset" , out responseHeader ) )
510+ {
511+ Debug . Log ( "X-RateLimit-Reset:" + TimeZone . CurrentTimeZone . ToLocalTime ( new DateTime ( 1970 , 1 , 1 , 0 , 0 , 0 , DateTimeKind . Utc ) . AddSeconds ( double . Parse ( responseHeader ) ) ) . ToString ( ) ) ;
512+ }
513+ }
514+
515+ return false ;
486516 }
487- if ( www . responseHeaders . TryGetValue ( "X-RateLimit-Reset" , out responseHeader ) )
517+
518+ if ( Regex . IsMatch ( www . text , "404 not found" , RegexOptions . IgnoreCase ) )
488519 {
489- Debug . Log ( "X-RateLimit-Reset:" + TimeZone . CurrentTimeZone . ToLocalTime ( new DateTime ( 1970 , 1 , 1 , 0 , 0 , 0 , DateTimeKind . Utc ) . AddSeconds ( double . Parse ( responseHeader ) ) ) . ToString ( ) ) ;
520+ Debug . Log ( "url:" + www . url ) ;
521+ Debug . Log ( "error:" + www . error ) ;
522+ Debug . Log ( www . text ) ;
523+ return false ;
490524 }
491-
492- return false ;
493525 }
494-
495- if ( Regex . IsMatch ( www . text , "404 not found" , RegexOptions . IgnoreCase ) )
526+ catch ( Exception e )
496527 {
497- Debug . Log ( "url:" + www . url ) ;
498- Debug . Log ( "error:" + www . error ) ;
499- Debug . Log ( www . text ) ;
528+ Debug . LogWarning ( e ) ;
500529 return false ;
501530 }
502531
0 commit comments