Skip to content

Commit 46728fe

Browse files
authored
Merge pull request #560 from CesiumGS/fix-reloading-crash
Fix crash resulting from GameObject being deleted before load thread finishes
2 parents aa2696e + 8203bec commit 46728fe

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## ? - ?
4+
5+
##### Fixes :wrench:
6+
7+
- Fixed a bug that could cause a crash when reloading a scene or tileset repeatedly.
8+
39
## v1.15.4 - 2025-03-03
410

511
##### Fixes :wrench:

native~/Runtime/src/UnityPrepareRendererResources.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,15 @@ UnityPrepareRendererResources::prepareInLoadThread(
920920
.thenInMainThread(
921921
[asyncSystem, tileset = this->_tilesetGameObject](
922922
IntermediateLoadThreadResult&& workerResult) mutable {
923+
if (tileset == nullptr) {
924+
// Tileset GameObject was deleted while we were loading a tile
925+
// (possibly play mode was exited or another cause).
926+
return asyncSystem.createResolvedFuture(
927+
TileLoadResultAndRenderResources{
928+
std::move(workerResult.tileLoadResult),
929+
nullptr});
930+
}
931+
923932
bool shouldCreatePhysicsMeshes = false;
924933
bool shouldShowTilesInHierarchy = false;
925934

0 commit comments

Comments
 (0)