CesiumGS / CesiumGS/cesium-unity

Deleting `Cesium3DTileset`, then undoing has irreversible consequences

Open
#418 1 comment 0 reactions 0 assignees View on GitHub
bug
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)...
![image](https://github.com/CesiumGS/cesium-unity/assets/32226860/7c326742-593b-4060-9171-a809a26faaa8)

... and some of them will appear un-georeferenced. In this screenshot, the purple streaks in the sky are floating tiles.
![image](https://github.com/CesiumGS/cesium-unity/assets/32226860/fcaf14e1-7eaf-4033-951b-4448b4f049eb)

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.