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"

Using TSoftClassPtr from a DataTable to spawn actor

Hey,

I'm trying to use a DataTbale where one of the fields is a blueprint subclass of AMyActor. In the Table Row struct (subclass of FTableRowBase) I've added a field

 TSoftClassPtr<AMyActor> MyClass;

In the csv file I'm using a reference to the blueprint (right-click -> Copy reference) and it seems importing normally – in the table overview I see this field is filled.

In my code, I'm trying to use this MyClass field to spawn actor:

 SpawnActor<AMyActor>(MyClass.Get())

but constantly getting the warning:

 SpawnActor failed because no class was specified

At the same time

 MyClass.IsValid() == false
 MyClass.IsNull() == false
 MyClass.IsPending() == false

Tried to call MyClass.LoadAsynchronous() but it have no effect.

Am I doing something wrong? How can I spawn actor from a class defined via a data table?

Product Version: UE 4.18
Tags:
more ▼

asked Feb 19 '18 at 07:09 PM in C++ Programming

avatar image

norlin
440 11 18 28

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

1 answer: sort voted first

Hi, your reference string to object Class should looks something like this "Blueprint'/Game/Blueprints/Test/TestBP.TestBP_C'" when " Copy reference" gives you something like this "Blueprint'/Game/Blueprints/Test/TestBP.TestBP'". The difference is the "_C" postfix.

more ▼

answered Apr 03 '18 at 08:34 PM

avatar image

Okorski
36 5 2

avatar image norlin Apr 04 '18 at 05:40 PM

Wow thanks! That's... hmm... obvious xD BTW I think it should be the answer, no? (I mean, not a comment)

(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