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"

Add Components To Actor From Child Component

So ive been moving one of my Blueprint Actor's over to an Blueprint Component cause it makes more sense and fits better. Then i noticed there is no way for an Component to add another Component to its owning actor.

This is major problem as my now Blueprint Component requires the ability to create multiple components during runtime.

Is this a planned feature or something that plans to stay the way it is?

Product Version: UE Github Master branch
more ▼

asked Feb 14 '16 at 04:23 PM in Blueprint Scripting

avatar image

100 14 18 25

avatar image ChaoSXDemon Feb 14 '16 at 06:40 PM

Not sure components should contain other components as this would break the intended design principal of components. Additionally components are usually ComponentActor objects which are not Actor objects. If you really want to do this, you probably have to go native.

avatar image Diddykonga Feb 14 '16 at 10:02 PM

I think you misunderstood what i was looking for, im not looking to add a component to another component, im looking to add a component to an actor, outside of that actors blueprint.

Component Blueprint: Owner->AddComponent(YourComponentHere)

avatar image ChaoSXDemon Feb 14 '16 at 11:08 PM

Should able to since there is this method in Actor.h

      * Creates a new component and assigns ownership to the Actor this is 
      * called for. Automatic attachment causes the first component created to 
      * become the root, and all subsequent components to be attached under that 
      * root. When bManualAttachment is set, automatic attachment is 
      * skipped and it is up to the user to attach the resulting component (or 
      * set it up as the root) themselves.
      * @see UK2Node_AddComponent    DO NOT CALL MANUALLY - BLUEPRINT INTERNAL USE ONLY (for Add Component nodes)
      * @param TemplateName                    The name of the Component Template to use.
      * @param bManualAttachment                Whether manual or automatic attachment is to be used
      * @param RelativeTransform                The relative transform between the new component and its attach parent (automatic only)
      * @param ComponentTemplateContext        Optional UBlueprintGeneratedClass reference to use to find the template in. If null (or not a BPGC), component is sought in this Actor's class
     UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", DefaultToSelf="ComponentTemplateContext", InternalUseParam="ComponentTemplateContext"))
     class UActorComponent* AddComponent(FName TemplateName, bool bManualAttachment, const FTransform& RelativeTransform, const UObject* ComponentTemplateContext);
avatar image j_zeitler Jan 25 '17 at 12:58 PM

I'm also having trouble with this. Cannot access GetOwner()->AddComponent from an owned component's blueprint

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

1 answer: sort voted first

Im getting around this for now by creating a function in C++ and exposing it to blueprints, since adding an component to an actor is easy in C++.

more ▼

answered Feb 16 '16 at 09:46 AM

avatar image

100 14 18 25

(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