Bolt should include collections that are 100% safe with AOT platforms.
The problem right now is that generic lists and dictionaries cannot be properly stubbed for AOT, meaning they'll throw errors when they would need to be JIT compiled. For this reason, they're disabled when AOT Safe Mode is enabled and the editor is targetting an AOT platform.
There could be two approaches here:
- Manually stub generic lists and dictionaries of certain common types, for example List<string> or List<float>. This is simple but ultimately very limited. If you need a list of a specific class or enum, it wouldn't work in AOT.
- Use non-generic, non-virtual collections that are guaranteed to be AOT safe, but have the downside of being non type-safe. This means that every list or dictionary type would be supported, but these collections could contain elements of different types in the same collection (e.g. a list with both string and float items).
Currently, I'm leaning towards approach #2. It would mean introducing two new types to Bolt (or more specifically to the Ludiq framework):
The list would behave exactly like an ArrayList, and the dictionary exactly like a Hashtable.
In the inspector, there would be a little additional setup step, defining the type of each item individually. It would look something like this:
Let me know if that would fit your different AOT workflows!
Finally, it's worth noting that when NOT targetting AOT, generic collections are superior in usability and performance, and ideally AOT collections should not be used.
Customer support service by UserEcho