Hi, recently I wanted to modularize some functionality to make it plug and play but I have an issue in the build. I basically have an abstract class which contains some abstract methods and properties. Then at runtime I collect all derived types and use Activator.CreateInstance() to instantiate the objects. It works perfectly in the Editor, but it breaks in the build because the compiler is stripping the default constructor from all the derived classes. I don’t want to disable stripping but I want to avoid having to manually define default constructors and using [Preserve] for every single derived class I have or will create later (since I can’t enforce a constructor I foresee times where me or someone using the code might forget to add a default constructor or use [Preserve] on it). So I tried [Preserve, RequireDerived] on the abstract class definition and [Preserve, RequiredMember] on a default constructor in the abstract class but neither worked. So I tried adding a link.xml file in one of my folders and put:
<linker>
<assembly fullname="Assembly-CSharp">
<type fullname="MyNamespace.MyAbstractClass" preserve="all"/>
</assembly>
</linker>
But it didn’t work… I tried using .* and other variations, etc, but still nothing. Can someone tell me what I’m doing wrong?..