Hi guys,
I have a path stored in a Vector3 JS Array (not built in) generated at runtime, and it works in the editor,
but the object does not move on device iP 3G and shows this exception in the xCode profiler…
also noticably slowing down the app, as it is obviously trying to do it every frame.
This is the error:
ExecutionEngineException: Attempting to JIT compile method ‘(wrapper dynamic-method) UnityEngine.Vector3:Vector3$x (object,object[ ])’ while running with --aot-only.
Any help with explaining what is “aot only” or something related to the Vector3 stuff there would be really appreciated.
I will try to find out myself in the meantime
If I recall correctly, someone figured out (might have even been Eric) that it should be available without any special imports. If not, it’s in the System.Collections.Generic namespace.
Arrays are great for performance, it’s really just a matter of how you use them. List actually wraps a built-in array. It just provides you very easy ways to modify that array (add/remove, some other nice methods) and it’s very fast too. My advice is to use the simplist/easiest API for your scripting then worry about performance/optimizations after.
EDIT: actually, depending on how you would use the array, the List class provides optimizations that make it faster (for example, adding items to an array resizes it, but it doesn’t resize 1 at a time, it doubles the array size so subsequent adds are very fast.)
Allright guys, thanks for your answers, I will look in to the List problematic right away, as I understand it will at least let me run the stuff on device to see the actual performance.
I think the main concern of this thread, as to understand the profiler message, has been solved. Thanks!
JS Arrays are not that great for performance, no, plus you have to worry about casting stuff correctly. And yeah, for some reason you can use List in JS without importing the System.Collections.Generic namespace, not that I’m complaining. While I’m in agreement with “don’t prematurely optimize”, there really is practically no reason to use Array, and several reasons why not, so you might as well just use List to begin with. Or ideally Vector3[ ] if you have a fixed-size array. But Lists are really quite fast, and you shouldn’t wreck your code trying to use Vector3[ ] if it’s easier to use List.
Thanks guys, I wonder if this will actually work on iPhone, since I have read that “System.Collections.Generic are not fully supported on the iPhone”? Was it pre unity 3.0 issue?
Assets/Scripts/PlayerManager.js(335,18): BCE0019: ‘Reverse’ is not a member of ‘Boo.Lang.List’.
in order to move on, and not spend all day figuring it out i set it up manually, although would rather use a built in method of course.
Thanks for asking.
for (var r1 : int = 1; r1 <= pathList.Count; r1++) {
pathListRev.Add(pathList[pathList.Count - r1]);
}
pathList = pathListRev;