Reply To: [NC2] AoT iOS Jit Error on Startup

NodeCanvas Forums Support [NC2] AoT iOS Jit Error on Startup Reply To: [NC2] AoT iOS Jit Error on Startup

#9794

Ok! We’ve got it fully working on PS4 now. I think…

After making the modifications to fsMetaProperty I listed above, we noticed that AnimationCurves were not deserializing properly, and somehow showed up with completely blank Keyframes. Since Keyframes are structs (and are therefore passed by value), fsMetaProperty.Write wasn’t modifying the Keyframes that would eventually be passed back to the AnimationCurves. The same thing was probably happening to Rects, but we didn’t notice because we don’t use Rects in our Graphs (except for layout, of course).

Our solution was to force pass-by-reference the context object into fsMetaProperty.Write using the ref keyword and then reassign the modified struct to that reference at the end. So, our final, working version of fsMetaProperty.Write looks like this:

Obviously, this is not the perfect solution. If we ever introduce new structs to NodeCanvas, we’ll likely have to update this function again. I also fear that we will have to update fsMetaProperty.Read if we ever introduce anything containing a struct to NodeCanvas. However, this works, and seeing as we have a deadline rapidly approaching, we’re going to roll with this fix for the time being.

Finally, we ran into a strange hard crash on our dev kits containing the error message Ran out of trampolines of type 2. Turns out trampolines are artifacts within Mono that are used in dealing with generics. Since NC2 by-and-large relies on generics more, you may run into this error. To fix it, go to your Player Settings, and under Other Settings, update AOT Compilation Options with nimt-trampolines=512. Trampolines ostensibly incur a memory cost, but I honestly haven’t researched it enough to know how many trampolines is too much, resource-wise.

So, complete (janky) solution:

  • Spoof the function calls for each of the value-types (i.e. primitives, enums, and structs) NodeCanvas needs to handle, using either Gavalakis or my templated method calls
  • For each of your structs that need to be deserialized, update fsMetaProperty.Write to include an explicit setter for each of the properties on that struct
  • For each of the objects that need to be serialized which contain a struct, update fsMetaProperty.Read to include an explicit getter for each of the fields on that object
  • If your game crashes with an error referencing “trampolines”, update your AOT Compilation Options to increase the number of trampolines available.

Hope that helps!