⚠ Preview docs — built from the develop branch and may be unstable. Go to the stable docs.

ComputeBuffer.GetData

T[] GetData()

Read the full buffer back from the GPU! This blocks until the data is ready, and allocates a new array each call. For per-frame readbacks, prefer the GetData(ref T[]) overload to avoid GC pressure!

   
RETURNS: T[] A new array containing the full buffer contents.
void GetData(T[]& data)

Read GPU data into a pre-allocated array! This is the allocation-free version of GetData, great for calling every frame without creating GC garbage. Reads Math.Min(data.Length, Count) elements.

   
T[]& data A pre-allocated array to fill. If it’s smaller than the buffer, only data.Length elements are read.




Found an issue with these docs, or have some additional questions? Create an Issue on Github!