- Home /
Missing properties in particle system during IL2CPP Build
Unity Version 2020.1.6f1 Inside of our game, we use reflection "GetProperties" to get all the properties from different modules in the Particle System for various procedurally balancing particle system reasons. In the game normally and in non-IL2CPP builds, when we do "GetProperties" on the Emission Module, we get the following properties:
"type, rate, rateMultiplier, enabled, rateOverTime, rateOverTimeMultiplier, rateOverDistance, rateOverDistanceMultiplier, burstCount"
However, when we make a IL2CPP build, the only properties in the module become: "enabled, rateOverTime, rateOverTimeMultiplier"
I imagine that when it makes a IL2CPP build, the classes are reconstructed, but I find it strange that some of the properties straight up go missing. I'd like to have access to the same properties I see are visible when making non-IL2CPP builds. Any ideas?
The binding flags I use: BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Default;
The method I'm debugging is by looping over GetProperty of the emission module and outputing each property name. There is defiantly some missing in the IL2CPP build.
Answer by JoshPeterson · Sep 28, 2020 at 12:02 PM
When the IL2CPP scripting backend is used, managed code stripping is enabled by default. This means that any managed code which is not used directly will be removed.
It sounds like this project has some managed code that is used only via reflection, and is therefore likely being removed. See the documentation here for more details about how to indicate that this code should not be removed: https://docs.unity3d.com/Manual/ManagedCodeStripping.html.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
IL2CPP problem on AddRange(List<>)? 0 Answers
IOS build size using IL2CPP 1 Answer