Browse Source

[ref] Don't preload references in editor

- Because prefabs aren't cached in editor, this causes a performance
hit in some cases like with the loading of datafiles
Clément Espeute 3 months ago
parent
commit
cd26cb950e
1 changed files with 3 additions and 5 deletions
  1. 3 5
      hrt/prefab/Reference.hx

+ 3 - 5
hrt/prefab/Reference.hx

@@ -76,14 +76,12 @@ class Reference extends Object3D {
 
 
 		super.load(obj);
 		super.load(obj);
 
 
+		#if !editor
 		if (source != null && shouldBeInstanciated() && hxd.res.Loader.currentInstance.exists(source)) {
 		if (source != null && shouldBeInstanciated() && hxd.res.Loader.currentInstance.exists(source)) {
-			#if editor
-			// we need the resCache to exist or we'll have an error in Ide.CustomeLoader.loadCache
-			if (@:privateAccess h3d.Engine.getCurrent()?.resCache == null)
-				return;
-			#end
 			initRefInstance();
 			initRefInstance();
 		}
 		}
+		#end
+
 	}
 	}
 
 
 	override function copy(obj: Prefab) {
 	override function copy(obj: Prefab) {