# FSoftObjectPath's ResolveObject() and TryLoad() do not work for PACKAGED build?

**URL:** <https://forums.unrealengine.com/t/fsoftobjectpaths-resolveobject-and-tryload-do-not-work-for-packaged-build/411048>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [November 30, 2017, 11:45pm UTC](https://forums.unrealengine.com/t/fsoftobjectpaths-resolveobject-and-tryload-do-not-work-for-packaged-build/411048 "2017-11-30T23:45:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Orakga](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Orakga](https://forums.unrealengine.com/u/Orakga)\
**Post date:** [November 30, 2017, 11:45pm UTC](https://forums.unrealengine.com/t/fsoftobjectpaths-resolveobject-and-tryload-do-not-work-for-packaged-build/411048/1 "2017-11-30T23:45:28Z")

</div>

I’ve successfully loaded Blueprint assets dynamically by using **FSoftObjectPath** to **ResolveObject()** and **TryLoad()**, but ONLY IN EDITOR.

When I try to run the same code in a **package build** or **dedicated server** , I get the “ **LogUObjectGlobals:Warning: Failed to find object…** ” error, which I believe typically occurs when you haven’t cooked your required assets properly. The thing is, however, I have cooked everything and even tried using “Cook everything in the project content directory”… to no avail.

The code is as follows:

```
FSoftObjectPath ItemToReference(AssetString);
UObject* ItemObject = ItemToReference.ResolveObject(); // <---- FAILS

if (!ItemObject) // if the asset isn't in memory already, try to load it
{
    ItemObject = ItemToReference.TryLoad(); // <---- FAILS
}

if (ItemObject)
{
    UBlueprintCore* GeneratedBP = Cast<UBlueprintCore>(ItemObject);
    // .... continue to spawn object using GeneratedBP...
}

```

(I also read somewhere that UBlueprint doesn’t work in Packaged builds, so my code uses UBlueprintCore instead)

Is this not the right method for loading assets dynamically in a packaged game? I have read about the **FStreamableManager** , but that appears to be a much more involving solution than necessary for what I’m trying to do.

Again, the code works perfectly in editor, so I assume this has to do with the running a packaged build.

---

<div class="post-metadata">

**Author:** ![Orakga](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Orakga](https://forums.unrealengine.com/u/Orakga)\
**Post date:** [December 1, 2017, 12:32am UTC](https://forums.unrealengine.com/t/fsoftobjectpaths-resolveobject-and-tryload-do-not-work-for-packaged-build/411048/2 "2017-12-01T00:32:34Z")

</div>

BTW, if it matters, the AssetString above is in the format **Blueprint’/Game/Actor1.Actor1’**

---

<div class="post-metadata">

**Author:** ![Orakga](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Orakga](https://forums.unrealengine.com/u/Orakga)\
**Post date:** [December 1, 2017, 3:11am UTC](https://forums.unrealengine.com/t/fsoftobjectpaths-resolveobject-and-tryload-do-not-work-for-packaged-build/411048/3 "2017-12-01T03:11:49Z")

</div>

> **[\[Feature Request\] bDontLoadBlueprintOutsideEditor=false by default](https://forums.unrealengine.com/questions/127212/bdontloadblueprintoutsideeditortrue-by-default.html)**
>
> Hi, This is not technically a bug but i think it should be corrected nonetheless. I opened (and closed) this thread: https://answers.unrealengine.com/questions/127139/packaged-game-crashes.html because i got systematic crashes with a packaged...

The above link was very helpful. I’m now using “ **Class** ’/… /…/name\*\*\_C” for the asset names instead (i.e. need to do some work on the reference copied from the UE4 engine first) and they are spawning in package and editor both. Sweet.

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [December 6, 2017, 7:00pm UTC](https://forums.unrealengine.com/t/fsoftobjectpaths-resolveobject-and-tryload-do-not-work-for-packaged-build/411048/4 "2017-12-06T19:00:11Z")

</div>

Hey Orakga,

In my previous post (that you reference in your answer), the class was loaded in the constructor, which wasn’t satisfying for a complete dynamic loading.

I opened a BR for the exact same problem (thinking the problem was elsewhere in an asset manager function) and found out it wasn’t a bug, just UE4 making things more difficult than they should.

I finally figured out it was again the same problem showing up one more time, and so i posted a complete working solution here once and for all:

[https://answers.unrealengine.com/questions/729231/requestasyncload-cant-find-assets-in-packaged-game.html](https://answers.unrealengine.com/questions/729231/requestasyncload-cant-find-assets-in-packaged-game.html)

Hopefully it’ll help many people bumping into the same problem 🙂

Cheers

Cedric

---

<div class="post-metadata">

**Author:** ![Orakga](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Orakga](https://forums.unrealengine.com/u/Orakga)\
**Post date:** [December 10, 2017, 5:36pm UTC](https://forums.unrealengine.com/t/fsoftobjectpaths-resolveobject-and-tryload-do-not-work-for-packaged-build/411048/5 "2017-12-10T17:36:31Z")

</div>

Thank you Cedric. I checked out your example as well, and apparently it works with “Blueprint…” as well? Anyhow, thanks again for sharing your findings!
