When using Unity LTS21 and Entities 0.51, even making a Tag IComponentData, GenerateAuthoringComponent crashes the DOTS compiler and shows roughly this in the error log:
* *error SGICE004: Seeing this error indicates a bug in the dots compiler. We'd appreciate a bug report (About->Report a Bug...). Thnx! <3 System.IO.IOException: Cannot create '{ProjectPath}\Temp\GeneratedCode\Assembly-CSharp' because a file or directory with the same name already exists.* *
Example code that breaks the compiler:
using Unity.Entities;
[GenerateAuthoringComponent]
public struct PlayerTag :IComponentData { }
I kept getting this as well, so I made this helper. If you place it in an Editor folder and hit Ctrl+Alt+R it will remove the GeneratedSource folder from the temp directory and then recompile. Fixes it right up for me.
Notice: make sure to look it over first and are comfortable with what it is doing before you run it, as it does delete a folder. Better safe than sorry.
That creates a new component. I have not tried creating any new ones in 0.51 yet, I have only had issues with existing components on occasion, which removing the GeneratedCode folder and recreating it by recompiling has worked every time for me so far. Strange that it didnât work for you. It just had the exact same error as before running it? I suppose itâs possible that whatever occurred that makes it happen in the first place simply happened again.
Iâve got the same problem. I moved today from a mac to a windows machine, and started getting this error:
<file>: error SGICE004: Seeing this error indicates a bug in the dots compiler. We'd appreciate a bug report (About->Report a Bug...). Thnx! <3 System.IO.IOException: Cannot create '<corresponding temp-file>' because a file or directory with the same name already exists.
the component itâs complaining about does not have a GenerateAuthoringComponent tag. The only workaround Iâve found is to delete the temp folder and trigger a compilation. That would be ok-ish, if it was not happening quite frequently.
Iâm on entities-0.51 and 2021.3.5f1. To repeat, tI never so this error in the mac editor.
Can you share more information than these errors, a callstack would help us look into this. @Soaryn I believe you already submitted a bug with the full logs so our team may already be investigating. Thank you!
Sorry, replied and deleted it by mistake.
The error is not happening anymore. I donât know why. I tried re-importing assets, and deleting Temp and Library but nothing helped. At some point, it just stopped happening. The Unity editor can do amazing things but needs a bit of work in terms of hermetic and repeatable builds. This sort of inconsistent behavior makes it very difficult to isolate and report bugs. In most cases is prohibitively time-consuming. Also, my project now is several GBs large, I wouldnât upload it for a bug report (not sure if I can even do that).
It might help if there was a âcapture bugâ mode that does extra logging that will allow users to file bugs easier, even at the expense of editor speed. If I could enable this mode and then push a bug report with a description to unity, I would push much more feedback.
I had the same error today, I created a new script and added references for âUnity.Physicsâ, âUnity.Physics.Hybridâ and âUnity.Mathematicsâ to my asmdef. After I deleted the script and the references, it worked again.
I then added the script and references again and this time had no more problems.
On my first try I added the script, after compilation errors the references.
I hadnât edited that SimpleCameraController file, however I did edit some existing components to have the GenerateAuthoringComponent attribute on them. Those components were originally regular MonoBehaviours, manually edited to be components, and then later manually edited to have the GAC attribute.
All of the components are namespaced in a nested namespace, but I didnât think much of it - but it made me think about what is public and private in those components.
Specifically, one component was using get/set syntax in its code. There are variables that are private when you use get/set syntax, and when I restarted the Unity Editor I got an error related to the protection level of those private variables. It was like the codegen couldnât do anything with the private variables.
After rewriting that component to not use get/set syntax, I restarted the Unity Editor and no errors appear any more. No protection level errors, no SGICE004 errors. All is well! Play mode works fine, too.
However, when I edit one of the components and cause a recompile in the project, I get this warning:
I just closed the editor, deleted my projectâs library folder, and reopened the editor. All works! No errors or warnings!
I closed and reopened the editor again to be sure - all still works! No errors or warnings!
I edited one of the components again, also to be sure - I get the SGICE006 warning again.
The SGICE006 warning isnât a blocking warning, so thatâs nice. I can keep on working.
I hope my lil journal of what happened when I got hit by SGICE004 helps!
Ah, nevermind - I edited a component again and now I have that SGICE004 on some of the other files again.
I even tried deleting the SimpleCameraController that came with the project, and then the SGICE004 error moved on to the âtutorialâ readme.cs file that came with the URP project template. I deleted that too, and now the SGICE004 error is on my project scripts. Canât exactly delete those.
Comparing to other experiences in this thread:
I have Hybrid Renderer installed
The Temp/GeneratedCode directory is a directory
Iâm not using asmdef files
Iâm using DOTS 0.51 and 2021.3.5f1
Deleting the Temp/GeneratedCode directory and editing a script to regenerate it did not remove the error
I then went through all of my DOTS-relevant scripts and removed any unused using statements. That has removed the error for now.
When I restarted the Unity editor and edited a script to be sure, I got the SGICE006 warning on one of my DOTS-relevant scripts. So the blocking error is gone for now, the warning is on a different file, but I can keep on working again.
Nothing about this error is consistent to me.
EDIT: Nevermind nevermind. The SGICE004 error is back on another of my DOTS-relevant files after I edited a different DOTS-relevant file. So still no method to the madness that I can see, just gonna file a bug report and hope Unity can handle this internally. So much for logging a journey to a solution on the forums!
I switched to 2021.3.6f1 the other day, and I canât say I recall having this issue since then. If I did and just didnât notice, it was has definitely been less often.