Unity-Technologies / VisualEffectGraph-Samples

Visual Effect Graph - Samples Project
Other
1.86k stars 387 forks source link

vfx parameters from script #2

Closed tanakataiki closed 3 years ago

tanakataiki commented 5 years ago

Does anybody tell me how to set vfx block parameters from script? It's shown in inspector yet I dont know how to get componet and parameters that I can set.

vfxInspector

kristafervale commented 5 years ago

Someone correct me if I'm wrong, but I believe you can just do:

visualEffect.SetFloat("parameter", 0);

where parameter is the name of the parameter you want to set as a string.

cocapasteque commented 5 years ago

Bump on this, can't find a way to control my spawn rate via a script... the SetFloat method from UnityEngine.Experimental.VFX.VisualEffect is not working, I have Value type for 'SpawnRate' is incorrect but it's the exact same name for the paramater.

EDIT : Nevermind, I forgot my parameter was Int and not float...