Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to correctly enable/disable the whole vfx graph without resetting to default?

Discussion in 'Visual Effect Graph' started by Cell-i-Zenit, Mar 13, 2020.

  1. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    288
    Hi,

    so i found that when you disable the vfx game object and enable it again, it will reset the values to default.

    Also disabling and enabling produces alot of lag because i need to set the values to the expected data again...

    is there a better way to stop a vfx graph?
     
  2. PaulDemeulenaere

    PaulDemeulenaere

    Unity Technologies

    Joined:
    Sep 29, 2016
    Posts:
    134
    Hi,

    I'm not sure to understand what kind of values are reseted, if you modify an exposed properties, then, you disable/enable the gameObject, modified values should remain.

    Does the VisualEffect.Reinit function correspond to your need ?

    Alternatively, you can also use custom named event or call VisualEffect.Stop.
     
  3. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    288
    It is really strange, for example if i create the vfx graph, set the game object to enabled, then set all the values via SetFloat etc, then disable the game object, the values are not stored.. if i reenable the object sometimes later the values are still default
     
  4. patSilva

    patSilva

    Joined:
    Mar 25, 2019
    Posts:
    27
    Was this ever resolved? I am having the same issue in my project.

    My visual effects were getting there values changes based on a struct that contained all of the data I was going to change. However when disabling and reenabling the effect's gameObject I have to reapply the struct's data because the values go back to the default.