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 Texture Property not getting updated by SetTexture call

Discussion in 'Visual Effect Graph' started by Murray_Zutari, Jul 29, 2022.

  1. Murray_Zutari

    Murray_Zutari

    Joined:
    Jun 1, 2017
    Posts:
    45
    I'm having this weird problem that I'm not sure how to solve. I'm trying to update the texture in my graph at runtime using VisualEffect.SetTexture(). But nothing happens.

    I can find the Property with the HasTexture call (the debug log fires) but the texture passed in does not show.

    I have also tried to use ExposedProperties but get the same result.

    Send help!

    EDIT: So it looks like the reason is that I restart the graph after setting the textures. Should I use a custom property binder to get around this?

    Code (CSharp):
    1. if (title.HasTexture("Title_Texture"))
    2.         {
    3.             Debug.Log("title tex found");
    4.             title.SetTexture(Shader.PropertyToID("Title_Texture"), data.name);
    5.         }
    6.  
    7.         if (description.HasTexture("Desc_Texture"))
    8.         {
    9.             Debug.Log("description tex found");
    10.             description.SetTexture(Shader.PropertyToID("Desc_Texture"), data.description);
    11.          
    12.         }
     
    Last edited: Jul 29, 2022
  2. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    324
    HI! Restarting the fx should not reset any overriden exposed properties. So mayybe a bug. What version are you on? Would you mind filing a bug with a minimal repro?
     
  3. Murray_Zutari

    Murray_Zutari

    Joined:
    Jun 1, 2017
    Posts:
    45
    I got this working with a custom property binder. I set the new texture and then restart the fx and it maintains the new texture. Using version 12.1.6. Will try submit a bug over the weekend.