Browse Source

Look for cached prefab first, then look in resource folder if not found

Josh Engebretson 10 years ago
parent
commit
0732d997cb
1 changed files with 7 additions and 1 deletions
  1. 7 1
      Source/Atomic/Scene/PrefabComponent.cpp

+ 7 - 1
Source/Atomic/Scene/PrefabComponent.cpp

@@ -50,7 +50,13 @@ void PrefabComponent::RegisterObject(Context* context)
 void PrefabComponent::LoadPrefabNode()
 {
     ResourceCache* cache = GetSubsystem<ResourceCache>();
-    XMLFile* xmlfile = cache->GetResource<XMLFile>("Cache/" + prefabGUID_);
+
+    // first look in cache
+    XMLFile* xmlfile = cache->GetResource<XMLFile>("Cache/" + prefabGUID_, false);
+
+    // if not found, could be loading a specific prefab
+    if (!xmlfile)
+        xmlfile = cache->GetResource<XMLFile>(prefabGUID_, false);
 
     if (!xmlfile || !node_)
         return;