diff --git a/assignment-client/src/scripts/EntityScriptServer.cpp b/assignment-client/src/scripts/EntityScriptServer.cpp index 6da935d0db..b2daabbd6c 100644 --- a/assignment-client/src/scripts/EntityScriptServer.cpp +++ b/assignment-client/src/scripts/EntityScriptServer.cpp @@ -281,12 +281,12 @@ void EntityScriptServer::entityServerScriptChanging(const EntityItemID& entityID } void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const bool reload) { - EntityScriptDetails details; - if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine && - _entitiesScriptEngine->getEntityScriptDetails(entityID, details)) { + if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine) { EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID); - if (entity && (details.scriptText != entity->getServerScripts() || reload)) { + EntityScriptDetails details; + bool notRunning = !_entitiesScriptEngine->getEntityScriptDetails(entityID, details); + if (entity && (reload || notRunning || details.scriptText != entity->getServerScripts())) { QString scriptUrl = entity->getServerScripts(); scriptUrl = ResourceManager::normalizeURL(scriptUrl); qDebug() << "Loading entity server script" << scriptUrl << "for" << entityID;