private void OnGameUpdate() { UpdateBuffer(ref _cellsIn, grid.Cells); UpdateBuffer(ref _cellsOut, grid.Cells); var cellScale = grid.GetCellScale(); computeShader.SetTexture(0, "Result", _renderTexture); computeShader.SetBuffer(0, "CellsIn", _cellsIn); computeShader.SetBuffer(0, "CellsOut", _cellsOut); computeShader.SetFloats("cell_scale", cellScale.x, cellScale.y); computeShader.SetInts("grid_size", grid.Size.x, grid.Size.y); computeShader.SetBool("compute", true); computeShader.Dispatch(0, _renderTexture.width / 8, _renderTexture.height / 8, 1); _cellsOut.GetData(grid.Cells); }