Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Setting Properties from Script does not show, although Property seems to be changed.

Discussion in 'Visual Effect Graph' started by VladDerGauner, Jun 2, 2020.

  1. VladDerGauner

    VladDerGauner

    Joined:
    Dec 3, 2015
    Posts:
    21
    Hey fellow VFX-Friends,

    I am trying to change some Property values via a script. The code I use is here:

    Code (CSharp):
    1. public void Awake()
    2. {
    3.     _connecterEffect = gameObject.GetComponent<VisualEffect>();
    4. }
    5.  
    AND

    Code (CSharp):
    1. public Vector3 IntermediateOne
    2. {
    3.     get { return _intermediateOne; }
    4.     set
    5.     {
    6.         Debug.Log(String.Format("We grab the value: {0}", _connecterEffect.GetVector3("IntermediateOne")));
    7.         _intermediateOne = value;
    8.         _connecterEffect.SetVector3("IntermediateOne", value);
    9.         Debug.Log(String.Format("After SET we get the value: {0}", _connecterEffect.GetVector3("IntermediateOne")));
    10.     }
    11. }

    What is surprising is that in the second `_connecterEffect.GetVector3(...)` I indeed get the correct value. But it does not show in the inspector, nor does the VFX-Graph change its behaviour accordingly.

    Help would be greatly appreciated.
     
    Last edited: Jun 3, 2020
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi, just as a sanity check, is the property in question exposed?
    upload_2020-6-3_10-11-58.png
     
  3. VladDerGauner

    VladDerGauner

    Joined:
    Dec 3, 2015
    Posts:
    21
    Hi, thanks for the response. Yes it is. Actually here is a picture of the 4 properties I am trying to alter:


    These VFX-Graphs are part of a Prefab, which looks like this:
     

    Attached Files:

  4. VladDerGauner

    VladDerGauner

    Joined:
    Dec 3, 2015
    Posts:
    21
    If I do the changes to the properties within the function the Prefab is instantiated in, I don't have any Problems. It feels like the values for the "wrong" VFX-Graph are changed.
     
  5. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Interesting, would you be able to submit a bug with the assets in question (or upload them here as a package) for us to take a look at?
     
  6. VladDerGauner

    VladDerGauner

    Joined:
    Dec 3, 2015
    Posts:
    21
    Hey, I will try to recover the bug.
    I solved it by reinstantiating prefabs for now. Which is not that good but yeah. :)
     
    Last edited: Jun 9, 2020
    VladVNeykov likes this.