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?
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.
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)
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);
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++.
I’m also having trouble with this. Cannot access
GetOwner()->AddComponent from an owned component’s blueprint
I’d like to hear an answer to this. I have some skill components (say Fireball) that wants to add status effect component (say Burning) to a hit actor, but I can’t because Add Component node is not available in actor component blueprint. This is inconvenient and I want to know why this is so.