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"

How do I load an actor Asset Pointer?

I have a TAssetPtr<AActor>, and it references an actor in an unloaded level. If I have opened the containing level in the editor, then calling LoadSynchronous() on that Asset pointer will give me a pointer to the actor. If, however, I have not opened the world in the editor, then LoadSynchronous() returns null.

What do I need to do so that LoadSynchronous() works?

Product Version: UE 4.16
Tags:
more ▼

asked Oct 30 '17 at 11:53 PM in C++ Programming

avatar image

Digi Labs Dan
571 16 14 35

avatar image Digi Labs Dan Oct 31 '17 at 11:04 PM

With some further testing, LoadSynchronous does seem to retrieve an actor from unloaded map. Maybe my code is mistaken in some other way.

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

1 answer: sort voted first

I figured it out. It turns out calling TAssetPtr<AActor>::LoadSynchronous actually does work.

Before 4.18 an asset pointer pointing to an Actor in any map other than the editor's current map will show up as "None", same as if it was unassigned, even if the asset is loaded. This made diagnosing the problem difficult. Right clicking on the field and choosing Copy will still allow you to get the long path name, which looks something like /Game/FooMap.FooMap:PersistentLevel.ModelRootActor.

The problem was actually rather simple. I was forgetting to call Modify on the object containing the asset pointer property. Then when I hit Save All, the asset pointer still had a long path name that referred to a nonexistent actor.

more ▼

answered Nov 01 '17 at 09:22 PM

avatar image

Digi Labs Dan
571 16 14 35

(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