Embed link.xml in UPM package (Unity3D)
In Unity (the game engine) you can tell the compiler not to strip away certain parts of your code, or to “preserve” it to use the correct term. You do this either with a
[Preserve] attribute, or with a
Up until recently, it was unknown how to include such a
link.xml file inside your UPM packages, as it had not been documented. Big thanks to maksimbu over at the Unity forums who did the most RnD here.
You have two main options:
Add a section to your
README.mdtelling your users to create a
link.xmlfile themselves in their
Assets/directory and add given content you specify.
link.xmlinside a precompiled assembly (DLL) inside your package.
We will be going through option 2.