Sometimes, the AOT compiler cannot figure out all thee code it needs to generate for an iOS project. When you call this code, the game crashes.

There are a few different causes.

To make Grids compile with iOS, follow these steps:

If you use a grid with your own cell type, you may need to add hits for the grid’s construction. To add compiler hints from the template, follow these steps:

  1. Find the method in Templates/CompilerHints.cs that corresponds to the grid you are using. For example, if you use a RectGrid, then find the method __CompilerHint__Rect().
  2. Copy this method to a place where you can easily call it (typically in the file where you instantiate your grid).
  3. Change the type __CellType to whatever cells you are using in your grid. You need a version of the hint method for each type of cell you are using.
  4. You need to call this method in a way that makes sure that the compiler does not take the call out as an optimization step. It doe snot really matter where you call it, as long as it is definitely called. A good place to put it is just before you construct the grid. The method always return true, so you can call it like this:

To find out more about this issue, see AOT Compiler Limitations and Workarounds for AOT compiler limitations.