UProperty & Particle System Component

Hello,
I was following a Programmer QuickStart tutorial from the Learn tab in the UE Launcher and i can across a bit of an issue and i was wondering if you can help;I completed the tut but the last section there is a do it you self where i have to add a particle system to an actor.

Add a Particle System Component to your FloatingActor. Some pre-built Particle Systems are already included in your project.
Use Unreal Engine’s UProperty macro to expose a variable for the magnitude of your FloatingActor’s movement, instead of using a hardcoded value. You might want to check the Variables, Timers, and Events tutorial for help on this topic.
Add periodic motion on the X and/or Y axis, and multiply the DeltaTime value by a number between 0.6 and 1.4, so your FloatingActor appears to float around freely. This can look great for powerups!

I’v been trying to do some research but im not getting the ans im looking for, was wondering if anyone here can point me in the right direction to go about adding the particle system to the actor with c++ code.

Thank You

Hi x1time_HAVOC,

Attaching a particle system is similar any other property when it comes to UProperty. The syntax for adding a UProperty in C++ is as follows:

UCLASS()
class MYPROJECT10_API AMyActor : public AActor
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere)
	UParticleSystem* Fire;
	
public:	
	// Sets default values for this actor's properties
	AMyActor();

In the above code, I added a particle system component to MyActor and named it Fire. Another key thing is to add the EditAnywhere tag after UPROPERTY. This allows you to both see the component in the editor and change its value. For more information about UProperty and the rest of Unreal’s reflection system, please go to the following link: Unreal Property System (Reflection) - Unreal Engine

If you encounter any further issues, please follow up. I’ll be happy to look into any other issues.

Have a nice day,

Matthew Clark

Thnaks for the reply :slight_smile: