unity build_error ai_generated partial

IL2CPP 错误:System.IO.DirectoryNotFoundException:找不到路径 'C:\Build\Temp\StagingArea\Data\Managed\System.dll' 的一部分

IL2CPP error: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Build\Temp\StagingArea\Data\Managed\System.dll'

ID: unity/il2cpp-error-marshal-directorynotfound

其他格式: JSON · Markdown 中文 · English
75%修复率
86%置信度
1证据数
2024-05-02首次发现

版本兼容性

版本状态引入弃用备注
Unity 2022.3.30f1 active
Unity 2023.2.5f1 active
Unity 6000.0.0a20 active

根因分析

IL2CPP 构建过程在暂存区找不到所需的托管程序集(例如 System.dll),通常是由于构建缓存不完整或缺少 .NET 后端文件。

English

The IL2CPP build process cannot find a required managed assembly (e.g., System.dll) in the staging area, often due to incomplete build cache or missing .NET backend files.

generic

官方文档

https://docs.unity3d.com/Manual/IL2CPP.html

解决方案

  1. Delete the 'Library' and 'Temp' folders in the project directory, then rebuild from scratch. This clears the corrupted build cache.
  2. In Project Settings > Player > Configuration, set 'Scripting Backend' to 'IL2CPP' and 'Api Compatibility Level' to '.NET Standard 2.1' (or '.NET Framework' if available). Then perform a clean build via Build Settings > Clean Build.

无效尝试

常见但无效的做法:

  1. 80% 失败

    The issue is a corrupted build cache, not missing Unity components.

  2. 95% 失败

    The staging area is regenerated each build; manual copies are overwritten or cause version mismatches.

  3. 50% 失败

    This avoids the error but changes the runtime behavior and may not be acceptable for platforms requiring IL2CPP (e.g., iOS, WebGL).