Hi!
I’m learning UE4 and just for practise, I want to a point light component for each projectile fired in the FPS template, I added some code to the template projectile class
UPROPERTY(EditAnywhere, Category = Projectile) class UPointLightComponent* Light;
How would you add a point light component using C++? Sorry for the noob question, this has been bugging me.
In your Projectiles Constructor add this line
Light = CreateDefaultSubobject<UPointLightComponent>(TEXT("MyLight"));
Light->AccesPropsOrCallFunctions();
Light->AttachTo(AnotherComponent);
etc.
You can also look into
NewObject<AYourType>(params)
Im a little bit in a hurry if you have any troubles let me know. Got to leave now =) Good Luck