I am wondering on how you go around getting an instance of an emitter from the content browser to spawn it from my code. What is the best approach to take to accomplish this?
Can you specify what exactly you are trying to do? Are you trying to emit particles somewhere in your level?
Hey! To create an Emitter in your script, you would need a UParticleSystem varialbe in your header. However, I highly suggest that you try the UParticleSystemComponent variable instead. The benefits of doing so, is that it works just like an emitter, but is much easier to deactivate/reactivate. Check out this script and if its not what you want, I can explain how you would use an Emitter.
In your Header (.h) File:
//Particle system variable
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Particles)
TSubobjectPtr<class UParticleSystemComponent> partclSystem;
In you Execution (.cpp) file:
//Create the particle system component. Make sure you have #include "ParticleDefinitions.h" as one of your headers, or this will not work
partclSystem = PCIP.CreateDefaultSubobject<UParticleSystemComponent>(this, TEXT("MyParticle"));
partclSystem->AttachTo(MeshVariable, "ASocketOfYourChoosing");
If you want to Activate/Deactivate the particle system, use
partclSystem->DeactivateSystem() //or ActivateSystem
Hope this helps!
Marc
What might be the reason if partclSystem->ActivateSystem() does not work ?
Try partclSystem->ActivateSystem(true) .