Skip to content

Commit

Permalink
Added event to notify when new gameobject is created
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Kaile committed Jun 20, 2023
1 parent 2a5ac46 commit 4cf8985
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

### ? - ?

##### Additions :tada:

- Added an event to notify when a new GameObject is created.

### v1.3.1 - 2023-06-06

##### Fixes :wrench:
Expand Down
10 changes: 10 additions & 0 deletions Runtime/Cesium3DTileset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ internal static void
}
}

public event Action<GameObject> OnNewGameObjectCreated;

internal void BroadcastNewGameObjectCreated(GameObject go)
{
if(OnNewGameObjectCreated != null)
{
OnNewGameObjectCreated(go);
}
}

internal static event Action OnSetShowCreditsOnScreen;

[SerializeField]
Expand Down
2 changes: 2 additions & 0 deletions Runtime/ConfigureReinterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ Cesium3DTilesetLoadFailureDetails tilesetDetails
"");
CesiumRasterOverlay.BroadcastCesiumRasterOverlayLoadFailure(overlayDetails);

tileset.BroadcastNewGameObjectCreated(new GameObject());

double3 cv3 = new double3();
cv3.x = cv3.y = cv3.z;
double3 cv4 = new double3(1.0, 2.0, 3.0);
Expand Down
2 changes: 2 additions & 0 deletions native~/Runtime/src/UnityPrepareRendererResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,8 @@ void* UnityPrepareRendererResources::prepareInMainThread(
}
});

tilesetComponent.BroadcastNewGameObjectCreated(*pModelGameObject);

CesiumGltfGameObject* pCesiumGameObject = new CesiumGltfGameObject{
std::move(pModelGameObject),
std::move(pLoadThreadResult->primitiveInfos)};
Expand Down

0 comments on commit 4cf8985

Please sign in to comment.