How to resize a Job NativeArray result?

Simply speaking:
In my AI System, I want the pathfind be calculate by a job. However, i find myself in trouble because the documentation says that i need to allocate the size of the array for the Job, even thought i read that NativeList is resizable, but it doesn’t say how.

So, do i do the result path as NativeList?

Note: the job inputs receives as input:

  • NativeArray as all the available path
  • MyStructCoordinates as start point
  • MyStructCoordinates as end point

NativeList resize itself automatically as you add more items over the initial limit like C#'s List

1 Like

A 5argon said, simply (example)

Unity.Collections.NativeList <int> list = new Unity.Collections.NativeList<int> () ;
            list.Add ( 2 ) ;
            list.Add ( 6 ) ;
            list.Add ( 2 ) ;
            list.Add ( 13 ) ;

Just like normal List

1 Like

Thank you guys. i’ve been busy and i couldn’t test it.
Thank you so much for the answers. Will look into it and I give a feedback.