SetVectorArray not working as expected (compute shader)

Hello all,
I need to draw a large amount of moving objects, each of which has its own position and a target that is shared between groups of them.

All objects are rendered with Graphics.DrawMeshInstanced successfully.

Graphics.DrawMeshInstancedIndirect( Mesh, 0, Material, bounds, argsBuffer, 0);

I've written a custom compute shader to move these objects.
I pass in a small VectorArray of Vector4 positions (which I then constantly update right before compute shader dispatch), but it only seems to take the first value.

This issue seems similar to this one here , but using a compute shader I can't set anything to "gpu instanced" to fix it (I tried with the material that draws the objects but not change).

Have I missed something, or is compute.SetVectorArray() buggy in Unity2021.2 hdrp?

EDIT (12/14/21): It turns out the SetVectorArray is being set correctly, its just not being indexed correctly for some reason. (I tested it by using explicit indices)...

EDIT (12/14/21): Resolved. The issue was the data in the C# struct wasn't in the same order as the data in the compute shader struct :pepoblanket:

SetVectorArray copies the elements, so changing the entries in your vector after calling SetVectorArray does nothing

[quote=“mabulous”, post:2, topic: 865278]
SetVectorArray copies the elements, so changing the entries in your vector after calling SetVectorArray does nothing
[/quote]

I understand that, which is why I set the values in the array. Then call set vector array with the updated list, then dispatch – each update.

Is that incorrect?

Example:

//Init function
//x is of type global Vector4[ ]
x = new Vector4[length].

//update
UpdateVec4ArrayValues()
compute.SetVectorArray("targets", x)

EDIT (12/14/21): It turns out the SetVectorArray is being set correctly, its just not being indexed correctly for some reason. (I tested it by using explicit indices)...