public override void DiscardChanges() { if (!IsVolumeHandleNull()) { CubiquityDLL.DiscardOverrideBlocksMC(volumeHandle.Value); } }
public override void CommitChanges() { if (!IsVolumeHandleNull()) { if (writePermissions == WritePermissions.ReadOnly) { throw new InvalidOperationException("Cannot commit changes to read-only voxel database (" + fullPathToVoxelDatabase + ")"); } CubiquityDLL.AcceptOverrideBlocksMC(volumeHandle.Value); //We can discard the blocks now that they have been accepted. CubiquityDLL.DiscardOverrideBlocksMC(volumeHandle.Value); } }
/// \endcond /// \cond public override void ShutdownCubiquityVolume() { // Shutdown could get called multiple times. E.g by OnDisable() and then by OnDestroy(). if (volumeHandle.HasValue) { // We only save if we are in editor mode, not if we are playing. bool saveChanges = !Application.isPlaying; if (saveChanges) { CubiquityDLL.AcceptOverrideBlocksMC(volumeHandle.Value); } CubiquityDLL.DiscardOverrideBlocksMC(volumeHandle.Value); CubiquityDLL.DeleteTerrainVolume(volumeHandle.Value); volumeHandle = null; } }