Storing simple heightmap for use in ISystem

Hello,

I would like to have a heightmap (whether it be 2D or 1D array of floats) generated based on the heights of a Terrain object that can be accessed in “OnUpdate()” of an ISystem such that the OnUpdate method can still be Burst Compiled. I would like to do this without Unity.Physics.

I am stuck because the size of this array would be too large for a DynamicBuffer and I am unable to save/load these heights from a file because (from what I understand) files cannot be accessed without the use of classes which would no longer allow the OnUpdate to be burst compiled.

Any recommendations would be greatly appreciated.

You can try blob assets. You can also just work with a texture and pass it to a Burst-compiled context using Texture2D.GetRawTextureData.

This isn’t a huge limitation in practice. Just split up your system so that you can use Burst where possible.

thank you so much! that works great!

1 Like