@@ -2603,34 +2603,36 @@ private static async Task<bool> DownloadFileAsync(string fileUrl, string destina
26032603
26042604 internal static string GetSRP ( string projectPath )
26052605 {
2606- // read projectsettings/graphicsettings file, look for m_SRPDefaultSettings: value
26072606 var settingsFile = Path . Combine ( projectPath , "ProjectSettings" , "GraphicsSettings.asset" ) ;
2608- if ( File . Exists ( settingsFile ) == false ) return null ;
2607+ if ( ! File . Exists ( settingsFile ) ) return null ;
26092608
2610- var allText = File . ReadAllText ( settingsFile ) ;
2611- var srpIndex = allText . IndexOf ( "m_SRPDefaultSettings:" ) ;
2612- if ( srpIndex == - 1 )
2613- {
2614- srpIndex = allText . IndexOf ( "m_RenderPipelineGlobalSettingsMap:" ) ; // unity 6000.2- ?
2615- if ( srpIndex == - 1 ) return null ; // BIRP
2616- }
2617-
2618- // urp = UnityEngine.Rendering.Universal.UniversalRenderPipeline
2619- // hdrp = UnityEngine.Rendering.HighDefinition.HDRenderPipeline
2609+ bool srpSectionFound = false ;
26202610
2621- if ( allText . IndexOf ( "UnityEngine.Rendering.Universal.UniversalRenderPipeline" , srpIndex ) > - 1 )
2622- {
2623- return "URP" ;
2624- }
2625- else if ( allText . IndexOf ( "UnityEngine.Rendering.HighDefinition.HDRenderPipeline" , srpIndex ) > - 1 )
2611+ using ( var reader = new StreamReader ( settingsFile ) )
26262612 {
2627- return "HDRP" ;
2628- }
2629- else
2630- {
2631- return null ; // BIRP
2632- }
2613+ string line ;
2614+ while ( ( line = reader . ReadLine ( ) ) != null )
2615+ {
2616+ if ( ! srpSectionFound )
2617+ {
2618+ if ( line . Contains ( "m_SRPDefaultSettings:" ) || line . Contains ( "m_RenderPipelineGlobalSettingsMap:" ) )
2619+ {
2620+ srpSectionFound = true ;
2621+ }
2622+ continue ;
2623+ }
26332624
2625+ if ( line . Contains ( "UniversalRenderPipeline" ) )
2626+ {
2627+ return "URP" ;
2628+ }
2629+ else if ( line . Contains ( "HDRenderPipeline" ) )
2630+ {
2631+ return "HDRP" ;
2632+ }
2633+ }
2634+ }
2635+ return null ; // BIRP or unknown
26342636 }
26352637
26362638 internal static void InstallAPK ( string ApkPath )
0 commit comments