I followed the instruction from the untiy documentation. The source generator works if I build the unity project with Rider, but if I build from the editor the generated code is not produced at all. Not sure what I Am doing wrong, it’s very basic.
Dll is marked as SourceGenerator and RoslyAnalyzer and I downloaded the source generator project from the dots netcode just to be sure about the settings.
Again it works if I compile with rider, but unity doesn’'t want to generate the code.
The weird thing is that when I created the new project it actually worked the first time, but once I switched from Windows to Android profile it stopped working. Switching backing to Windows didn’t fix it.
There are a couple of rules to remember:
- The generator dll must be marked with RoslynAnalyzer. Done
- The generator dll must live in inside an asmdef folder (either the root or a sub-folder)
- The generator will only run for the assemblies that depends on that asmdef.
That being said, how do you determine that the code is not generated? It is because it does not compile or it is because it is not emitted (in terms of file) ?.
1 Like
thanks. Everything you said is listed in the documentation and I followed the documentation by the letter. Curiously, the DOTS netcode documentation also says to add the label “SourceGenerator” which I did too. The code doesn’t compile because the expected generated code is not generated.