I have this method
public static unsafe void ClearMemory<T>(
this NativeList<T> nativeList)
where T : struct
{
UnsafeUtility.MemClear(nativeList.GetUnsafePtr(), nativeList.Length * UnsafeUtility.SizeOf<T>());
}
and I get the following error:
The type 'T' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'
Arrays are working fine, but Lists don’t.
Anybody got a suggestion?