Facebook Twitter Gplus LinkedIn RSS

Unity Serializer, Mono and Trampolines!


If you are using Unity Serializer in AOT environments (like iPhone and Droid) you may find that you run out of trampolines.  Causing a sudden and terminal exit of your game.  By default Mono doesn’t allocate a large number of Type2 trampolines which are related to the use of Interfaces (which US does a lot).  You may also run out of other trampolines due to the use of generics.


Never fear – you can ask for some more in the Player Settings -> AOT Compilation Options

Mine are set like this:




nrgctx-trampolines=8096 (these are recursive generics – the default is 1024)

nimt-trampolines=8096 (these are to do with interfaces and the default is 128)

ntrampolines=4048 (are to do with generic method calls, by default there are 1024)

Now whether you will need to set this is down to how much you use these features yourself.  My coding style uses a lot of generics and generic methods + interfaces so these settings are pretty high.

Home Programming Unity Serializer, Mono and Trampolines!