Unity Issue Tracker - Preserved fields are stripped when the assembly is not referenced
Closed
UUM-75750
Preserved fields are stripped when the assembly is not referenced
Unity: IL2CPP
As Designed
6.0.X
2022.3.X
2021.3.X
Not a bug. Use [assembly: AlwaysLinkAssembly]
https://docs.unity3d.com/ScriptReference/Scripting.AlwaysLinkAssemblyAttribute.html
How to reproduce:
1. Open the “IL2CPPReference.zip“ project
2. Open the “SampleScene“
3. Build and run the project using IL2CPP backend with “Development Build“ enabled
4. Observe the Player Console
Expected result: a “WOOHOO“ error is logged
Actual result: no error is logged