Hello,
I'm dealing with the initial performance spike when the scene loads. After using Profiler, I found that the first initialization of NativeList is more performance consuming than the following initializations of NativeLists.
For testing I created the following basic script:
using UnityEngine;
using Unity.Collections;
using UnityEngine.Profiling;
public class testScript : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Profiler.BeginSample("test list 1");
NativeList<int> list1 = new NativeList<int>(10, Allocator.Temp);
Profiler.EndSample();
list1.Dispose();
Profiler.BeginSample("test list 2");
NativeList<int> list2 = new NativeList<int>(10, Allocator.Temp);
Profiler.EndSample();
list2.Dispose();
}
}