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 to get class from actor blueprint?

I have created a blueprint that is meant to be able to spawn actors from a dynamic set of blueprints, and the spawn actor from class function requires a class to be passed in to spawn an actor, how can I get the class from a blueprint I have created and pass that class into the spawn actor function?

Basically I want to be able to have logic to select a blueprint (or class) and spawn that as an actor from the blueprint script.

Product Version: Not Selected
Tags:
more ▼

asked Apr 02 '14 at 06:57 PM in Blueprint Scripting

avatar image

lunix
76 14 21 25

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

2 answers: sort voted first

Some from my understanding you got set of blueprint classes (since blueprint is practically a class as same as coded in C++) and one class that select one of those classes and spawn them.

I can't find block which would grab asset form content browser, but C++ has APIs for that so you could try to use that if you got skill. Alternatively, you could create array of classes and select classes from that array.

more ▼

answered Apr 02 '14 at 07:19 PM

avatar image

Shadowriver
35.9k 928 169 1105

avatar image lunix Apr 02 '14 at 07:23 PM

I am aware I could do it in C++, I'm sure many things are possible through C++ that go beyond the blueprint system, however, I want to try to exclusively use the blueprint system.

To your second point about the array of classes, the problem still remains of how to extract the class from a blueprint within a blueprint event graph.

avatar image mikepurvis Apr 02 '14 at 07:28 PM

I'm not sure you need to extract it, you can spawn bluebrints, they are really classes, which the _c tacked to the end of their name kind of indicates. I have used the SpawnActor node and in the selection box dropdown my blueprints that do extend from Actor in some way are there.

As for looping through the list of them. I'm not 100% sure, but have you looked at the Blueprint LibraryAsset?

avatar image Shadowriver Apr 02 '14 at 07:28 PM

You mean class of a blueprint that graph is in?

then "Get a reference to self" -> Get Class -> Do stuff

In general "Get Class" will extract class from any object whatever you want to do :)

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

alt text

This is my event graph and I want to add a switch statement to select between different blueprints and spawn actors based on that.

eventgraph.png (90.5 kB)
more ▼

answered Apr 02 '14 at 07:39 PM

avatar image

lunix
76 14 21 25

avatar image Shadowriver Apr 02 '14 at 07:55 PM

Ahhhh then maybe you searching for "Switch on..." :)

avatar image lunix Apr 02 '14 at 08:03 PM

the programming concept of a switch which is a selector between any number of case statements.

(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