How to avoid "Saving Chunks" in editor mode

0
kennir posted this 27 October 2015

Hi,

I want write my own editor extension for editing tiled map, I made a PicaVoxel.Volume as prefab, and create a custom editor just like PicaVoxel.VolumeEditor, I instantiate a PicaVoxel.Volume from prefab after I clicked on a grid, but problem is: Volume will call SaveChunks If it's created from editor, It's a long time if I instantiate many volumes at once, so, Is it possible to avoid volume SaveChunks? RunTime voxel mode is ok,but I want to show the voxel in realtime on editor mode,

Thanks !

5 Comments
Order By: Standard | Newest | Votes
0
GarethIW posted this 27 October 2015

If I were you, I'd add a new public boolean flag to Volume.cs (bool IsTile for example) that you can set to true on your prefab. Then at the top of Frame.cs / SaveChunkMeshes(), check your flag (ParentVolume.IsTile) and return out of the method if true.

If you're using the standard PicaVoxel Volume prefab, I'd suggest copying it as your own Tile prefab that you can set your flag on.

Hope that helps!

0
kennir posted this 27 October 2015

That's great! Let me have a try

0
kennir posted this 28 October 2015

Hi GarethIW

I have add a flag for disable SaveChunkMeshes, but the instantiated volume is invisible until I click "refresh chunk" manually.

Frame.cs public void SaveChunkMeshes(bool forceNew) {

if UNITY_EDITOR

        if (ParentVolume.DontSaveChunks) return;

Have any idea ?

0
GarethIW posted this 28 October 2015

Yes, try calling UpdateAllChunks() before you return.

0
kennir posted this 28 October 2015

Thank you, the UpdateAllChunks will now work fine


Our 125 members have posted 459 times in 111 discussions