Cysharp / MemoryPack

Zero encoding extreme performance binary serializer for C# and Unity.
MIT License
3.29k stars 193 forks source link

Error when using union in unity #140

Closed gotenxds closed 1 year ago

gotenxds commented 1 year ago

When creating three classes and having one of them as abstract and the two classes that inherit from it will result in the following error MemoryPack.Generator.Roslyn3\MemoryPack.Generator.MemoryPackGenerator\SaveData.FarmAnimals.FarmAnimalSaveData.MemoryPackFormatter.g.cs(48,32): error CS0234: The type or namespace name 'Collections' does not exist in the namespace 'SaveData.System' (are you missing an assembly reference?)

It seems that the generated class has in incorrect import statement (SaveData is my namespace)

If I change the namespace name it code compiles fine

neuecc commented 1 year ago

Can you give me the full code? However, System is a bit of a dangerous namespace, ......, which is easily covered when generated.