Hey everyone,
I’m trying to create a UActorComponent and attach it to an AActor. I am creating the component outside of the actor I want to attach it to. The commented stuff is just some stuff I tried but also failed.
(In case that pic is too small)
UPloppableComponent* NewPloppableComp = NewObject(PlaceableActor, UPloppableComponent::StaticClass(), TEXT(“PloppableComponent”), RF_Transient);
PlaceableActor->AddInstanceComponent(NewPloppableComp);
//FTransform transform;
//PlaceableActor->AddComponent(TEXT("PloppableComponent"), false, transform, UPloppableComponent::StaticClass());
//UActorComponent* NewComp = NewObject<UActorComponent>(PlaceableActor, UPloppableComponent::StaticClass(), TEXT("PloppableComponent"));
//NewComp.(PlaceableActor->GetRootComponent());