7

I am currently developing a project using Unity 2020.3.3f1. I use git version control system and store my project in a Bitbucket repository. When I clone / pull my project to another computer (especially with macos) some of my cs. files are displayed as an unknown file` (not a script) in the project view, and some other classes cannot find the class defined on that file. When I right click and select "reimport" the cs file, recovered immediately and I build successfully.

This causes me a problem when I try to build my project through Unity Cloud build, because I get an error about some missing classes which are indeed there.

[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

After that I tried pulling the project from a Mac device, the project also could not recognize the same MaterialLayer.cs. I easily recovered using "reimport". My project settings / Asset Serialization : Force Text and "Version Control / Visible Meta Files" are already set.

1
  • 4
    you can check that the respective .meta files unity generates for each of the files is uploaded to the repository. Just to give an idea of what you can check to be in order... Commented Aug 2, 2021 at 8:34

2 Answers 2

3
+150

It's a long shot and I write answer only because I can attach image here:

Every file in C# solution has properties:

enter image description here

So my suggestion is to double check if those "missing", "unknown" .cs files have same properties set as those .cs files, which are recoginzed correctly.

1

If you using LFS on git then this issue sometimes happens when LFS pulled with a bug or metafiles was broken during pulling files, please double check your .gitattributes. It's possible that the merge option for .meta was wrongly assigned. I'm using this .gitattributes for my projects, still no issues with this.

Not the answer you're looking for? Browse other questions tagged or ask your own question.