CesiumGS / CesiumGS/cesium-unity
Deleting `Cesium3DTileset`, then undoing has irreversible consequences
- Dominant language
- C#
- Stars
- 535
- Forks
- 132
- Avg merge
- 6h 45m
- Merged PRs (30d)
- 1
Description
I accidentally deleted a `Cesium3DTileset` in one of the sample levels (though it doesn't matter which), and tried to undo it. But this messes up a lot.
Firstly, the console gets spammed with these error messages:
```
This Mesh Collider is attached to GameObject at path 'CesiumGeoreference/Cesium World Terrain/[url]/Mesh 0 Primitive 0' with Mesh '' in Scene '01_CesiumWorld', but the mesh doesn't have any vertices.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
```
Then, as tiles attempt to reload, many of them will appear purple (indicating a material with errors)...

... and some of them will appear un-georeferenced. In this screenshot, the purple streaks in the sky are floating tiles.

I imagine that undoing the deletion is pretty disastrous for the state management of Cesium3DTileset, but I believe it's because the delete operation is recording the deletion of the child game objects -- even those marked `HideAndDontSave`. So when I undo the operation, it adds back all of those game objects. This prevents the tileset from properly cleaning up when it is disabled and reenabled.
I don't know if this can be prevented, but hopefully there's a way to intercept the undo operation and prevent the tiles from being reattached?
Contributor guide
Assessment
This issue has not been assessed yet.