IL2CPP 추가 인자에 관한 플랫폼별 설정 처리
Supply custom additional arguments to the IL2CPP compiler from code.
읽는 시간 1분최근 업데이트: 한 달 전
프로젝트에 추가 IL2CPP 인자 설정이 있는 경우 둘 이상의 플랫폼을 컴파일하면 특히 Linux용으로 크로스 컴파일할 때 예상과 다르게 작동할 수 있습니다.
추가 IL2CPP 인자가 이미 설정되어 있는지 알아보려면 다음 중 한 가지를 수행하십시오.
- 환경 변수 가 설정되었는지 확인합니다.
IL2CPP_ADDITIONAL_ARGS - 에서 에디터 스크립트에
ProjectSettings/ProjectSettings.asset라는 값이 있는지 확인합니다.additionalIl2CppArgs
추가 IL2CPP 인자를 설정하는 메서드는 전역적으로 모든 플랫폼에 적용되므로, 원하는 플랫폼이 아닌 플랫폼에 대해 설정하면 컴파일 문제가 발생할 수 있습니다. 후크(아래 참조)를 사용하여 IL2CPP 인자가 필요한 플랫폼에 대해서만 설정되도록 합니다.
IPreprocessBuildWithReportIPreprocessBuildWithReport hook
다음과 같이 후크를 사용하여 스크립트를 작성하거나 빌드 다이얼로그를 사용하여 추가 인자를 설정할 수 있습니다.
IPreprocessBuildWithReportclass MyCustomPreprocessBuild: IPreprocessBuildWithReport{ public int callbackOrder { get { return 0; } } public void OnPreprocessBuild(BuildReport report) { string addlArgs = ""; if (report.summary.platform == BuildTarget.StandaloneWindows || report.summary.platform == BuildTarget.StandaloneWindows64) addlArgs = "--compiler-flags=\"d2ssa-cfg-jt\""; UnityEngine.Debug.Log($"Setting Additional IL2CPP Args = \"{addlArgs}\" for platform {report.summary.platform}"); PlayerSettings.SetAdditionalIl2CppArgs(addlArgs); }}