After having gone through and deleted all my sprites to open the project in Unity 2020.2b12 I got it to export an xcode project on for the iOS platform. After running the game for about 20seconds and into the main menu (where I use burst compiled code) it immediately crashes with the strack trace
Unable to find internal function
‘Unity.Burst.LowLevel.BurstCompilerServices::GetOrCreateSharedMemory’ Unity.JobsLowLevel.Unsafe.JobsUtility.CreateJobReflectionDataType(Type, Object, Object, Object) UnityEngine.Jobs.TransformParallelForLoopStruct’1:Initialize() UnityEngine.Jobs.IJobParallelForTransformExtension:Schedule(ObjectMoveJob,TransformAccessArray, JobHandle)
So my understanding is that it crashes immediately when I create a Job which deals with some transforms in a for loop.
[BurstCompile]
public struct ObjectMoveJob : IJobParallelForTransform
{
[ReadOnly]
public NativeArray<ObjectMove.ObjectData> ObjectData;
public NativeArray<ObjectMove.ObjectMoveData> ObjectMoveData;
[ReadOnly]
public NativeArray<float3> Waypoints;
public float DeltaTime;
public void Execute(int index, TransformAccess transform)
{
var moveData = ObjectMoveData[index];
int currentWaypoint = moveData.CurrentWaypoint;
bool reverseDirection = moveData.ReverseDirection;
bool loop = ObjectData[index].Loop;
float rotationCorrection = ObjectData[index].RotationCorrection;
float speed = ObjectData[index].MoveSpeed;
var pos = transform.position;
var transformPosition = new float3(pos.x, pos.y, pos.z);
if (currentWaypoint < ObjectData[index].EndWPIndex && currentWaypoint >= ObjectData[index].StartWPIndex)
{
var waypoint = Waypoints[currentWaypoint];
var target = new float3(waypoint.x, waypoint.y, waypoint.z) + ObjectData[index].Offset + ObjectData[index].Shift;
if (math.distance(target, transformPosition) < 0.1f)
{
currentWaypoint = reverseDirection ? currentWaypoint - 1 : currentWaypoint + 1;
}
else
{
var moveDirection = target - transformPosition;
//Never rotate up or down
moveDirection.y = 0;
var look = quaternion.LookRotation(moveDirection, new float3(0, 1, 0));
//Rotate by rotation correction. Used by surfers
var offset = quaternion.RotateY(math.radians(rotationCorrection));
var rotation = math.mul(look, offset);
transform.position = MoveTowards(transformPosition, target, speed * DeltaTime);
transform.rotation = math.slerp(transform.rotation, rotation, DeltaTime * ObjectData[index].RotationSpeed);
}
}
else
{
if (loop)
{
if (currentWaypoint >= ObjectData[index].EndWPIndex)
{
currentWaypoint = ObjectData[index].StartWPIndex;
}
else if (currentWaypoint <= ObjectData[index].StartWPIndex)
{
currentWaypoint = ObjectData[index].EndWPIndex - 1;
}
}
else
{
reverseDirection = !reverseDirection;
if (reverseDirection)
{
currentWaypoint -= 1;
}
else
{
currentWaypoint += 1;
}
}
//Log($"2 reverseDirection = {reverseDirection} currentWaypoint = {currentWaypoint} start: {ObjectData[index].StartWPIndex} end: {ObjectData[index].EndWPIndex}");
}
moveData.CurrentWaypoint = currentWaypoint;
moveData.ReverseDirection = reverseDirection;
ObjectMoveData[index] = moveData;
}
private static float3 MoveTowards(
float3 current,
float3 target,
float maxDistanceDelta)
{
float num1 = target.x - current.x;
float num2 = target.y - current.y;
float num3 = target.z - current.z;
float num4 = (float) ((double) num1 * (double) num1 + (double) num2 * (double) num2 + (double) num3 * (double) num3);
if ((double) num4 == 0.0 || (double) maxDistanceDelta >= 0.0 && (double) num4 <= (double) maxDistanceDelta * (double) maxDistanceDelta)
return target;
float num5 = (float) math.sqrt((double) num4);
return new float3(current.x + num1 / num5 * maxDistanceDelta, current.y + num2 / num5 * maxDistanceDelta, current.z + num3 / num5 * maxDistanceDelta);
}
}