rikimaru0345 / Ceras

Universal binary serializer for a wide variety of scenarios https://discord.gg/FGaCX4c
MIT License
484 stars 53 forks source link

Bug: Unity Editor Compilation error in EditorExtension.cs #92

Closed viseztrance closed 3 years ago

viseztrance commented 3 years ago

Hi, I've received this error after copying Ceras to my Unity game project:

Assets/Vendor/CerasSerializer/Ceras.UnityAddon/Editor/EditorExtension.cs(30,23): error CS7036: There is no argument given that corresponds to the required formal parameter 'output' of 'Generator.Generate(string, IEnumerable, StringBuilder)'

I'm assuming it's happening because of this change.

So I guess Generator.Generate(assemblies, sb) needs to be changed to Generator.Generate(ns, assemblies, sb); (and in Ceras.AotGeneratorApp/Program.cs as well).

Can ns be any arbitrary string, or does it need to match my own games namespace?

rikimaru0345 commented 3 years ago

The namespace argument just tells the source generator in which namespace to place the Formatters it generates.

Since Ceras does not dynamically lookup any Formatter by its name, it should work. Ceras 'gets' the Formatters from its config. The generated formatters are added to Ceras' config here: https://github.com/rikimaru0345/Ceras/blob/603a32395c4772aa3ac6e05490b0f77de5aaff0e/src/Ceras.AotGenerator/SourceGenerator/SourceFormatterGenerator.cs#L30

So yes, it should be possible to just use an arbitrary name (as long as it is something that you can use as a namespace in C#, like it shouldn't have any invalid symbols :P ).

If you decide to change the EditorExtension, could you submit a PR?

viseztrance commented 3 years ago

Thanks for looking into this so quickly.

If you decide to change the EditorExtension, could you submit a PR?

Sure, I would be happy to do so.