c# - 从 git 中提取项目后,Unity 无法识别某些 .cs 文件

标签 c# git unity3d atlassian-sourcetree

我目前正在使用 开发一个项目统一 2020.3.3f1 .我用 git 版本控制系统并将我的项目存储在 中比特桶 存储库。当我将我的项目克隆/pull 到另一台计算机(尤其是使用 macos)时,我的一些 cs.文件在项目 View 中显示为未知文件(不是脚本),并且其他一些类找不到在该文件上定义的类。当我右键单击并选择“重新导入”cs 文件时,立即恢复并成功构建。
当我尝试通过 构建我的项目时,这给我带来了问题。 Unity 云构建,因为我收到了一些关于确实存在的缺失类的错误。

[Unity] Initialize engine version: 2020.3.6f1 (338bb68529b2)
3: [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/ToonyColorsPro.Editor.dll
4: [Unity] Assets/JMO Assets/Toony Colors Pro/Editor/Shader Generator/Config.cs(192,13): error CS0246: The type or namespace name 'MaterialLayer' could not be found (are you missing a using directive or an assembly reference?)
5: [Unity] Assets/JMO Assets/Toony Colors Pro/Editor/Shader Generator/ShaderProperty.cs(417,40): error CS0246: The type or namespace name 'MaterialLayer' could not be found (are you missing a using directive or an assembly reference?)
6: [Unity] Assets/JMO Assets/Toony Colors Pro/Editor/Shader Generator/Config.cs(173,59): error CS0246: The type or namespace name 'MaterialLayer' could not be found (are you missing a using directive or an assembly reference?)
7: [Unity] Assets/JMO Assets/Toony Colors Pro/Editor/Shader Generator/Config.cs(192,13): error CS0246: The type or namespace name 'MaterialLayer' could not be found (are you missing a using directive or an assembly reference?)
8: [Unity] Assets/JMO Assets/Toony Colors Pro/Editor/Shader Generator/ShaderProperty.cs(417,40): error CS0246: The type or namespace name 'MaterialLayer' could not be found (are you missing a using directive or an assembly reference?)
9: [Unity] Assets/JMO Assets/Toony Colors Pro/Editor/Shader Generator/Config.cs(173,59): error CS0246: The type or namespace name 'MaterialLayer' could not be found (are you missing a using directive or an assembly reference?)
10: ! build of 'default-ios-ad-hoc' failed. exit
11: publishing finished successfully.
12: Finished: FAILURE
之后我尝试从 Mac 设备中提取项目,该项目也无法识别相同的 MaterialLayer.cs。我使用“重新导入”轻松恢复。
我的项目设置/ Assets 序列化:强制文本和“版本控制/可见元文件”已经设置。

最佳答案

这是一个长镜头,我写答案只是因为我可以在这里附上图片:
C# 解决方案中的每个文件都有属性:
enter image description here
所以我的建议是仔细检查那些“失踪”、“未知”.cs文件具有与 .cs 相同的属性设置文件,这些文件被正确识别。

关于c# - 从 git 中提取项目后,Unity 无法识别某些 .cs 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67342205/

相关文章:

c# - 将一个事件处理程序添加到另一个事件处理程序

ios - 类型 '[Root]' 的值没有成员 'commit' 。我如何解码 JSON 根数组

mobile - OnApplicationFocus()和OnApplicationPause()有什么区别?

c# - 获取屏幕空间中的 UnityEngine.UI.Images 位置并计算归一化偏移量(在覆盖 Canvas 内)

c# - 缺少 Microsoft.WindowsAzure.Diagnostics 程序集

C# 反射性能帮助

c# - Server.Transfer 在 Application_Error 中不起作用

git - 列出 git-ls-remote 时,为什么标签名称后有 "^{}"?

git - 在git代理密码中转义@字符

android - 使用 Google Cardboard SDK Unity,当一个可能在每一帧实例化的对象出现在 View 中时,显示变黑