I have a C++ component that I’ve created which has two Niagra particle system pointers:
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class ZOMBIETOWN_API UGunComponent : public UActorComponent
{
// ** usual stuff here, begin play so on..
public:
// ** other properties here...
// Properties I'm having trouble with below...
UPROPERTY(BlueprintReadWrite, EditAnywhere)
UNiagaraSystem* MuzzleFlashParticles = nullptr;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
UNiagaraSystem* HitParticles = nullptr;
};
I find that I can set “HitParticles” and “MuzzleFlashParticles” in the editor when I make a blueprint class inheriting from AActor and attaching a UGunComponent to it, as desired. But when I save the project, save the blueprint class, close the editor and re-open, I find that those variables get reset to null again!
I find that when I change the particle systems in the editor and save, the uasset
file for the blueprint class changes. The diff looks like a couple of bytes. So it looks like maybe it’s not being reloaded?
Edit: I tried DUPLICATING this blueprint class, and the duplicate works as expected – I can save an reload the particles. So for now, I have a workaround, but I have no idea why the original keeps resetting?