CreateChunks() doesn't create new chunks?

Devwulf posted this 25 April 2018

Whenever I make the x, y, and z sizes bigger or smaller through script, the amount of chunks doesn't change. Say I take the default PicaVoxel base prefab and change its x, y, and z sizes on runtime to 16,16,16, I should only get one chunk in the end, instead of the default 8 chunks. That doesn't happen however. I also tried Rebuild() and UpdateAllChunks() to no avail. I'm allowing users to create their own stuff, so having this kind of functionality would be very useful. Will you be implementing this in the future?

Last edited 25 April 2018

Order By: Standard | Newest | Votes
GarethIW posted this 25 April 2018

There's a few things you need to do when setting up a new volume/changing the size of a volume programatically. Hopefully the following Gist should give some pointers:

Without seeing your code, I imagine the missing step for you is setting the Frame dimensions to the same size as the Volume dimensions, and/or resizing the voxel data array (Frame.Voxels)

If you are looking to implement a volume resize that keeps the current voxel data, I suggest looking at Scripts/Editor/EditorResizeWindow.cs to see how I do it in the editor.

Devwulf posted this 25 April 2018

Ah, you're right! Those 2 that you mentioned were exactly what I was missing! Thanks for the help, and for the great asset!

Our 137 members have posted 528 times in 128 discussions