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"

Use Add Child Actor Component with a variable for the Class

I'm using a Add Child Actor Component and it placing the actor exactly where I want it. However I want to be able to set the class using any given item out of an array. Is there a way I can do that?

I have tried using SpawnActor instead, then using Attach Actor to Component, but using that method I never saw the actor.

Product Version: Not Selected
more ▼

asked Mar 25 '15 at 05:33 AM in Blueprint Scripting

avatar image

66 5 11 63

avatar image alperenakyuz Mar 25 '15 at 11:59 AM

You can't make an array of classes if that's what you're asking. You can create a user-defined structure though.

avatar image Sentient Mar 26 '15 at 12:22 AM

Hmm, currently I'm using a array of actors. When I get an item out of that array I can plug it into the Class pin on Spawn Actor. It would be awesome if Add Child Actor Component had a Class pin.

avatar image vctr Aug 26 '15 at 06:05 PM

You can set class of ChildActorComponent by this way alt text

avatar image Arty-McLabin Jan 21 '17 at 03:01 PM

works! thank you

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

1 answer: sort voted first


Both of these solutions seem to work for me:

alt text alt text

actor.jpg (71.8 kB)
actor2.jpg (80.7 kB)
more ▼

answered Mar 25 '15 at 11:14 AM

avatar image

257 17 9 29

avatar image Sentient Mar 26 '15 at 12:24 AM

Thanks for the screenshots! At least I know I'm trying close to the right thing. Unfortunately I still can't see the actor when using Spawn actor. I've tried lots of options for different transforms and also the different options in "Attach Location Type".

avatar image Sentient Mar 26 '15 at 12:26 AM

Also, it looks like you're blueprints are in the Level Blueprint. I'm trying to do this inside my own blueprint. I don't know if that would make much difference. Where you use "Default Scene Root" I just use "Get Root Component" or drag in the "Scene" object.

avatar image potatojoe Mar 26 '15 at 07:59 AM

This is not the Level Blueprint, but an Actor-Blueprint. Default Scene Root is the default component inside an actor, as long as you dont add anything to it.

avatar image potatojoe Mar 26 '15 at 08:04 AM

When you use the spawn actor method, are you sure that you have set the default value of the class variable? Its not enough that the variable is of the right type... Thats a mistake I made creating this Blueprint, and it would end in the same result as yours.

avatar image Sentient Mar 29 '15 at 02:36 AM

That wasn't my problem.. I was trying to use SpawnActor in a function called by the construction script, which apparently fails without any errors or warnings. I moved it elsewhere and everything works now. Thanks for your help!

(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