summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/mesh_library.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp
index ad8da63abf..f04af29761 100644
--- a/scene/resources/mesh_library.cpp
+++ b/scene/resources/mesh_library.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "mesh_library.h"
+#include "core/engine.h"
bool MeshLibrary::_set(const StringName &p_name, const Variant &p_value) {
@@ -201,6 +202,11 @@ Transform MeshLibrary::get_item_navmesh_transform(int p_item) const {
Ref<Texture> MeshLibrary::get_item_preview(int p_item) const {
+ if (!Engine::get_singleton()->is_editor_hint()) {
+ ERR_PRINT("MeshLibrary item previews are only generated in an editor context, which means they aren't available in a running project.");
+ return Ref<Texture>();
+ }
+
ERR_FAIL_COND_V_MSG(!item_map.has(p_item), Ref<Texture>(), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'.");
return item_map[p_item].preview;
}