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

Resolved Shader Graph : Sample Texture 2D node Texture value unique per game object ?

Discussion in 'Shaders' started by Boccfil, Jul 30, 2021.

  1. Boccfil

    Boccfil

    Joined:
    May 17, 2021
    Posts:
    1
    Hi,

    I have made the following Shader Graph which works fine for my need but I would like to know if it is possible to attach this shader to differents GameObjects while not having the same texture attached to it ?

    For example, in GAMEOBJECT2 image, I would like to assign ShinyVFX sprite as MainTexture while keeping LightGlare to GAMEOBJECT1.

    In other words, I want this shader to blur Image component texture. Is it possible ? Script needed ? Or the way I have done the Shader Graph does not fit my need and I have to start from the beginning with another approach ? If so can you put me on track please ?

    Thanks !

    EDIT :
    Solution is to create dynamic material through script : https://answers.unity.com/questions/1409060/is-there-any-way-to-create-a-dynamic-material-when.html

    ShaderGraphBlur.jpg GameObjectIllustration.png
     
    Last edited: Jul 31, 2021
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    A sprite / UI material’s main texture is hidden in the inspector, and then overridden by the renderer component. There’s no reason to create unique materials for each.