# IL2CPP 추가 인자에 관한 플랫폼별 설정 처리

> Supply custom additional arguments to the IL2CPP compiler from code.

프로젝트에 추가 IL2CPP 인자 설정이 있는 경우 둘 이상의 플랫폼을 컴파일하면 특히 Linux용으로 크로스 컴파일할 때 예상과 다르게 작동할 수 있습니다.

추가 IL2CPP 인자가 이미 설정되어 있는지 알아보려면 다음 중 한 가지를 수행하십시오.

* 환경 변수 `IL2CPP_ADDITIONAL_ARGS`가 설정되었는지 확인합니다.
* `ProjectSettings/ProjectSettings.asset`에서 에디터 스크립트에 `additionalIl2CppArgs`라는 값이 있는지 확인합니다.

추가 IL2CPP 인자를 설정하는 메서드는 전역적으로 모든 플랫폼에 적용되므로, 원하는 플랫폼이 아닌 플랫폼에 대해 설정하면 컴파일 문제가 발생할 수 있습니다. `IPreprocessBuildWithReport` 후크(아래 참조)를 사용하여 IL2CPP 인자가 필요한 플랫폼에 대해서만 설정되도록 합니다.

## IPreprocessBuildWithReport hook

다음과 같이 `IPreprocessBuildWithReport` 후크를 사용하여 스크립트를 작성하거나 빌드 다이얼로그를 사용하여 추가 인자를 설정할 수 있습니다.

```
class 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);
    }
}
```

## 추가 리소스

* [Linux IL2CPP 크로스 컴파일러](/engine/6000.0/manual/scripting/compilation-and-code-reload/backends/il2cpp/linux-il2cpp-crosscompiler.md)
* [Windows 런타임 지원](/engine/6000.0/manual/scripting/compilation-and-code-reload/backends/il2cpp/il2cpp-windows-runtime-support.md)
* [매니지드 스택 추적](/engine/6000.0/manual/scripting/compilation-and-code-reload/backends/il2cpp/il2cpp-managed-stack-traces.md)
