x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

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.

Product Version: UE 4.18
Tags:
more ▼

asked Nov 30 '17 at 11:45 PM in Packaging & Deployment

avatar image

Orakga
35 5 11 14

avatar image Orakga Dec 01 '17 at 12:32 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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

Hopefully it'll help many people bumping into the same problem :-)

Cheers

Cedric

more ▼

answered Dec 06 '17 at 07:00 PM

avatar image

uced
850 75 91 360

avatar image Orakga Dec 10 '17 at 05:36 PM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

https://answers.unrealengine.com/questions/127212/bdontloadblueprintoutsideeditortrue-by-default.html

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.

more ▼

answered Dec 01 '17 at 03:11 AM

avatar image

Orakga
35 5 11 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question