From b45e670d21aba429a0fa50da707090cb100be0e3 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 7 Aug 2019 13:55:16 -0400 Subject: [PATCH] Fix BUGZ-1197 (and others): Ensure enterEntity is emitted when avatar is inside entity and script is reloaded --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 5cb7b89de5..305384361d 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -1027,6 +1027,10 @@ void EntityTreeRenderer::addingEntity(const EntityItemID& entityID) { void EntityTreeRenderer::entityScriptChanging(const EntityItemID& entityID, bool reload) { checkAndCallPreload(entityID, reload, true); + // Force "re-checking" entities so that the logic inside `checkEnterLeaveEntities()` is run. + // This will ensure that the `enterEntity()` signal is emitted on clients whose avatars + // are inside an entity when the script is reloaded. + forceRecheckEntities(); } void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID, bool reload, bool unloadFirst) {