I wanted to make a generic arg-sort using NativeSort like this:
(...)
sortedIndexes.Sort(
new ArgSort<float>
{
Values = endTimes,
}
);
}
// Also tried T : unmanaged
private struct ArgSort<T> : IComparer<int> where T : struct, IComparable
{
public NativeArray<T> Values;
public int Compare(int x, int y)
{
return Values[x].CompareTo(Values[y]);
}
}
But I get the following error:
Error: Burst error BC1020: Boxing a valuetype `System.Single` to a managed object is not supported
Is the problem using a generic parameter, even though it's limited to structs/unmanaged types?