CreateChunks() doesn't create new chunks?

0
Devwulf posted this 5 weeks ago

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 5 weeks ago

2 Comments
Order By: Standard | Newest | Votes
1
GarethIW posted this 5 weeks ago

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:

https://gist.github.com/GarethIW/2740ee670dc7085aa926fbd6f354dfd9

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.

0
Devwulf posted this 5 weeks ago

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 123 members have posted 452 times in 108 discussions