I want to read the value of the variable “SpriteSize” but I don’t know how to do it.
I tried to read it as an array but the editor crashed
Any way to get that value?
Thank you very much!!
I want to read the value of the variable “SpriteSize” but I don’t know how to do it.
I tried to read it as an array but the editor crashed
Any way to get that value?
Thank you very much!!
I wish somebody will reply. I don’t know why there cant be a simple Get method
It is because C++ is a language strongly typed (BluePrints is based in C++)
User parameters are not designed to be read from the component, they are write-only. Niagara components should be used for cosmetic purposes only, so if you rely on them to drive other logic in your game then that’s a good hint that your code architecture is wrong.
If I remember correctly, I wanted to change the size of the Sprite… So yes, I think that’s write-only. With C++ I don’t have any problems. I set the size in the constructor of the object class and it works. I don’t know from Bluprint… but I’m no longer interested in it. Now I only use C++ because it is less problematic than bluprints. Blueprints are a pain in the head.
Thank you very much for your comment!!
i think this is what you need
https://www.unrealengine.com/marketplace/en-US/product/expose-niagara-variables-c-blueprints
Anyone found a way without the plugin?
No problem with C++
Can you please share how? I’m tryiig to get a FVector, using FNiagaraVariant, can’t seem to cast it right.
in your .H
UPROPERTY(EditDefaultsOnly)
TObjectPtr<class UNiagaraComponent> Niagara = nullptr;
float SpriteSize=200.0f;
In your .CPP
Niagara->SetVariableFloat("SpriteSize", SpriteSize);
if you want a vector, then do it like this:
Niagara->SetVariableVec3("SphereOrigin", Location);
Thanks, but Set is easy. I want to read user parameter
You do not need read it because you already have it in your C++ class
Not in my situation. I’m not defining it like OP, I’m reading from a groom component.
It’s ok, I have figured it out, thanks.
Actually, can’t use GetCurrentParameterValue, it’s an editor only
Then I think there is not another available methods to read data from Niagrara. It’s like the materials. you can write but not read. (That explains why no one answered my question in two years).
I have not used groom component too. But maybe you can try to get the data from it instead Niagara.
Or maybe you can see the plugin provided by this user… it is another option