So I just made the switch from Mono 2x to IL2CPP due to Apple’s requirement of a 64-bit version. My original version was working fine, but now that I’m using a link.xml, BoxCollider2D doesn’t seem to work (via Set Property). What I’m trying to accomplish is enabling and disabling the Collider through triggers. The odd thing is that it works fine on Unity, but once it builds to an iOS device, it doesn’t. Any help?
Which version of Unity are you using? We had a bug related to this property which I believe was corrected in 5.0.1p1. I’m not sure though if this is a same problem, as we may be seeing something else here.
Can you try this with the Mono scripting backend locally? I wonder if it is a problem specific to IL2CPP? It seems to be different than the original issue we fixed. Also, what is the behavior your see which indicates this is not working? Is there an exception that occurs?
My project was actually completely finished and in full working condition in Mono until I made the switch to IL2CPP.
Certain triggers are supposed to turn BoxCollider2D off and on, but my player collides with everything (as if the BoxCollider2D is already triggered when it’s not supposed to be) when it should be passing through. I am also attempting to enable and disable isTrigger, but that also is not working. Do I need to add anything to my link.xml to allow isTrigger to work on my BoxCollider2D?
It works fine on my Unity, but does not work on my iPad Air or my iPhone 6.
There is not a fix that I know of yet. You can submit a bug report via Help > Report a Bug in the editor. Please let me know the bug number when you submit it, and we will have a look at it.
@JoshPeterson - I have reported the bug with a test scene. The bug number is #732822. I may have forgotten to include the link.xml, but if I did, the one posted here is the one I am currently using. Thanks again for your help!
We’re facing the same thing within the PlayMaker Community
and that doesn’t work when published on IOS, setting the .isTrigger via reflection simply fails without any errors, it just doesn’t do anything.
Since there is already a bug being reported, I won’t create a new one, but it would be good to address it. I did test it both in Unity 4.7 and Unity 5.3.1 f1
Now the problem is going to be the following: how can we know about these combinations? …
I wrote a wizard that goes over each reflection done ( within PlayMaker ) and output the linker xml content, and so it seems I will have to start creating rules for additional types to preserve… Is there a list somewhere of these types that requires additional preservation entries?
No, unfortunately we don’t have a good way to understand these dependencies in the managed code stripper right now. We have some ideas about how to improve this situation though. We need to extend the stripper to understand a relationship like this: “If A depends on B, and B is preserved, preserve A as well.” But we don’t have that yet.
The safest thing to do now is to keep everything in the UnitEngine assembly (or namespace). Of course doing that may have a noticeable impact on the build size though.
Indeed keeping the whole UnityEngine would defeat the purpose of the linker and optimized build sizes…
So, I have implemented a hardcoded list of types to includes if inherited by the class being reflected. It doesn’t cover other similar cases, but at least I’ll be able to make updates as we find other classes like BoxCollider2D.
Hi Jean-Fabre… Any chance you can share this list? I am currently trying to figure out the most efficient way to generate a link.xml file for AssetBundles I am loading