Search Unity

Question ShaderGraph: access sprite secondary texture in shader for UI image

Discussion in 'Shader Graph' started by RedHillbilly, Jan 31, 2021.

  1. RedHillbilly

    RedHillbilly

    Joined:
    Mar 24, 2014
    Posts:
    39
    I have a sprite with the usual
    _MainTex
    and an additional
    _inner
    texture defined as secondary texture in the sprite editor.
    When I want to access this secondary texture for a material meant for the sprite renderer, I can just enter the "ref" as
    _inner
    in the
    Texture2D
    property, works like a charme.

    But when I try to do the same with the same sprite with a shader meant for a UI image (in-game UI), the shader does not appear to find the secondary texture (so the same shader works on my SpriteRenderer, but doesn't on my UI image renderer).

    Am I doing something wrong? Any idea what?

    Thanks
     
  2. RedHillbilly

    RedHillbilly

    Joined:
    Mar 24, 2014
    Posts:
    39
    Sorry to bump this, I still can't figure it out, any ideas?
     
  3. lepus525

    lepus525

    Joined:
    Dec 26, 2017
    Posts:
    4
    I encountered same problem.
    still looking for answers.
     
    RedHillbilly likes this.
  4. unity_STWR-WB9WnBhFA

    unity_STWR-WB9WnBhFA

    Joined:
    Sep 4, 2019
    Posts:
    2
    i got the same. when i manually set the secondary texture in the property of the shader during runtime it works but it doesnt grab it automatically in an image like it does on the sprite renderers... pretty much clueless here :-/
     
  5. RedHillbilly

    RedHillbilly

    Joined:
    Mar 24, 2014
    Posts:
    39
    @lepus525 @unity_STWR-WB9WnBhFA
    Got an answer over at Unity Answers, it seems like it's not supported at the moment, didn't find a workaround in shaders, I just use 2 superposed images for now.