I’m trying to integrate my networking support using C# sockets. I’ve got a system worked up that uses some reflection and the System marshalling support to pin some memory and serialize fields into a byte array for transmission… This works in my stand-alone testbed scenes. However when integrating it back in my “real” game, I get this:
Exception: This project is using both System.dll and System.Xml.dll therefore will build only when assembly stripping is enabled (Unity iPhone Advanced feature).
Please avoid any unnecessary references to System.dll or System.Xml.dll. Common classes that should be avoided are: Stack, Sockets and Xml (...)
So it won’t build for the device without stripping, but stripping breaks all of my fancy reflection based network state tracking!!! It also breaks the C# Ani.Mate implementation because that uses reflection as well… Is there any hope for this to work? I need networking and I need reflection!!! I’m not really in the mood to re-write 2 weeks of networking junk and/or Ani.Mate
Actually, we do have the advanced license. I’m using native Obj-C interfaces for the Bonjour stuff And I have all the stripping options. They just break my reflection based code. The sockets and stuff work stand alone in my non-complex test environment. Integrating them with my full game leads to this message.
Nothing in his message denoted to me that he didn’t have Advanced, in fact he stated that ‘stripping’ in fact broke something, thus he must have used it to know that
Hello Stephen,
you need to hint mono linker about the types that you use via reflection. Easiest way - just declare variables of such types somewhere in the scripts.
I do have instances of these classes around. For instance, I use Ani.Mate to control fieldOfView on the main camera. When stripping is enabled, this field/property cannot be found by Type.GetField() or Type.GetProperty(). I even tried declaring dummy cameras. Also my network state blocks are declared and used elsewhere in the scripts, but their fields cannot be located at runtime (the get returns null). This makes Marshal.SizeOf() freak out
Anyway, I had a similar error tonight. I was using iPhone Basic, got the same error you listed above. So I decided that well, it’s time to buck up and get iPhone Advanced. After upgrading and trying to reboot Unity several times, I was still getting the error.
What worked for me was editing the Player Preferences, located in
Edit → Project Settings → Player
This opens up the player settings on the right hand side of the screen in the inspector view.
I think once you buy advanced you have access to modify a property called “iPhone Stripping Level”. I set mine to “Strip Assemblies” and was able to build to my iPod once again.
Hope this helps, if not you someone else… as I stumbled upon this post in a Google search.