Download

Can i use components like UActorComponent,USceneComponent,UPrimivitiveComponent with?

my question is can i use above mentioned components with helloworldprinter class? as helloworldprinter class is an actor?
Am i right?
https://docs.unrealengine.com/latest/INT/Programming/QuickStart/7/index.html

Yes,

You can do it 2 ways:

In c++ you have to create a root component first in the contstructor:



AHelloWorldPrinter::AHelloWorldPrinter(const FObjectInitializer& ObjectInitializer)
    : Super(ObjectInitializer)
{

// Root component
SceneRoot = ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, "SceneRoot");
RootComponent = SceneRoot;

// Then you can attach sub components to the root component 
ActorComponent = ObjectInitializer.CreateDefaultSubobject<UActorComponent>(this, "Anythingyouwant");
ActorComponent ->AttachParent = RootComponent;
}


Here is a detailed tutorial for this:
https://wiki.unrealengine.com/Actor_Components,Making_Native%26_Deferred_Attached_to_Socket

Or you can create a blueprint inherited from your c++ class and in the components section you can add your components within the editor.