Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: calculmentor on July 18, 2022, 08:49:46 AM

Title: vfx graph
Post by: calculmentor on July 18, 2022, 08:49:46 AM
hi there !

I'm facing serious trouble having access to vfx graph exposed property in PM...
even the binding property script from unity seems to bind only a few properties..
what's going on ?
shader graph works like a charme with the get material float action !
but, there's no way to drive vfxgraph with PM ??
thx
Title: Re: vfx graph
Post by: calculmentor on July 18, 2022, 10:55:36 AM
ok...
working this way with PM exemple:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.VFX;

public class VFXController_skin_particle: MonoBehaviour
{
    [SerializeField]
    private VisualEffect visualEffect;

    [SerializeField, Range(0.005f, 0.05f)]
    public float ParticlesMaxSize = 0.005f;

    //[SerializeField]
    //private Gradient meteorGradient = null;

    [SerializeField, Range(0, 300000)]
    public int ParticlesRate = 200;

    void Update()
    {
        visualEffect.SetFloat("ParticlesMaxSize", ParticlesMaxSize);
        visualEffect.SetInt("ParticlesRate", ParticlesRate);
        //visualEffect.SetGradient("MeteorGradient", meteorGradient);
    }
}
Title: Re: vfx graph
Post by: Luceid on September 05, 2023, 12:53:44 PM
Alternatively, you can use the "call method" playmaker action and set your values very quickly! (I apologize for double posting this, but I wanted to make sure the top few google searches had the easiest method for solving this problem.)
Make sure the parameter is exposed on the graph if it isn't working for you, and make sure to use a method like "void SetFloat (string, float)" where the string is the parameter name.
Title: Re: vfx graph
Post by: djaydino on September 06, 2023, 12:58:03 PM
Hi.
its not recommended to use call method (especially if you would use it Every Frame)

as its mirroring, which is slower than dedicated actions. (which would be fine in most cases)
But build for other platforms you might need to use Linker Wizard (http://hutonggames.com/playmakerforum/index.php?topic=11126.0) to make sure its included in a build