@@ -121,6 +121,22 @@ internal static bool UseIl2CppCodegenWithMonoBackend(BuildTargetGroup targetGrou
121121 EditorApplication . useLibmonoBackendForIl2cpp &&
122122 PlayerSettings . GetScriptingBackend ( targetGroup ) == ScriptingImplementation . IL2CPP ;
123123 }
124+
125+ internal static bool EnableIL2CPPDebugger ( BuildTargetGroup targetGroup )
126+ {
127+ if ( ! EditorUserBuildSettings . allowDebugging )
128+ return false ;
129+
130+ switch ( PlayerSettings . GetApiCompatibilityLevel ( targetGroup ) )
131+ {
132+ case ApiCompatibilityLevel . NET_4_6 :
133+ case ApiCompatibilityLevel . NET_Standard_2_0 :
134+ return true ;
135+
136+ default :
137+ return false ;
138+ }
139+ }
124140 }
125141
126142 internal class IL2CPPBuilder
@@ -190,8 +206,8 @@ public void RunCompileAndLink()
190206 Il2CppNativeCodeBuilderUtils . ClearAndPrepareCacheDirectory ( il2CppNativeCodeBuilder ) ;
191207
192208 var buildTargetGroup = BuildPipeline . GetBuildTargetGroup ( m_PlatformProvider . target ) ;
193- var useDebugBuild = PlayerSettings . GetIl2CppCompilerConfiguration ( buildTargetGroup ) == Il2CppCompilerConfiguration . Debug ;
194- var arguments = Il2CppNativeCodeBuilderUtils . AddBuilderArguments ( il2CppNativeCodeBuilder , OutputFileRelativePath ( ) , m_PlatformProvider . includePaths , m_PlatformProvider . libraryPaths , useDebugBuild ) . ToList ( ) ;
209+ var compilerConfiguration = PlayerSettings . GetIl2CppCompilerConfiguration ( buildTargetGroup ) ;
210+ var arguments = Il2CppNativeCodeBuilderUtils . AddBuilderArguments ( il2CppNativeCodeBuilder , OutputFileRelativePath ( ) , m_PlatformProvider . includePaths , m_PlatformProvider . libraryPaths , compilerConfiguration ) . ToList ( ) ;
195211
196212 arguments . Add ( string . Format ( "--map-file-parser=\" {0}\" " , GetMapFileParserPath ( ) ) ) ;
197213 arguments . Add ( string . Format ( "--generatedcppdir=\" {0}\" " , Path . GetFullPath ( GetCppOutputDirectoryInStagingArea ( ) ) ) ) ;
@@ -292,16 +308,15 @@ private void ConvertPlayerDlltoCpp(ICollection<string> userAssemblies, string ou
292308 break ;
293309 }
294310
295- if ( EditorUserBuildSettings . allowDebugging && platformSupportsManagedDebugging && EditorApplication . scriptingRuntimeVersion == ScriptingRuntimeVersion . Latest )
311+ if ( IL2CPPUtils . EnableIL2CPPDebugger ( buildTargetGroup ) && platformSupportsManagedDebugging )
296312 arguments . Add ( "--enable-debugger" ) ;
297313
298314 var il2CppNativeCodeBuilder = m_PlatformProvider . CreateIl2CppNativeCodeBuilder ( ) ;
299315 if ( il2CppNativeCodeBuilder != null )
300316 {
301- var useDebugBuild = PlayerSettings . GetIl2CppCompilerConfiguration ( buildTargetGroup ) == Il2CppCompilerConfiguration . Debug ;
302-
317+ var compilerConfiguration = PlayerSettings . GetIl2CppCompilerConfiguration ( buildTargetGroup ) ;
303318 Il2CppNativeCodeBuilderUtils . ClearAndPrepareCacheDirectory ( il2CppNativeCodeBuilder ) ;
304- arguments . AddRange ( Il2CppNativeCodeBuilderUtils . AddBuilderArguments ( il2CppNativeCodeBuilder , OutputFileRelativePath ( ) , m_PlatformProvider . includePaths , m_PlatformProvider . libraryPaths , useDebugBuild ) ) ;
319+ arguments . AddRange ( Il2CppNativeCodeBuilderUtils . AddBuilderArguments ( il2CppNativeCodeBuilder , OutputFileRelativePath ( ) , m_PlatformProvider . includePaths , m_PlatformProvider . libraryPaths , compilerConfiguration ) ) ;
305320 }
306321
307322 arguments . Add ( string . Format ( "--map-file-parser=\" {0}\" " , GetMapFileParserPath ( ) ) ) ;
0 commit comments