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

How to use .SetFloat with nameID:int param?

Discussion in 'Shaders' started by IntDev, Aug 28, 2014.

  1. IntDev

    IntDev

    Joined:
    Jan 14, 2013
    Posts:
    152
    I thought it was like the animator feature where you can put a hashkey there, so I tried:

    Code (csharp):
    1. hash = Animator.StringToHash("_Value");
    2. // ...
    3. thing.renderer.sharedMaterial.SetFloat(hash, value);
    But didn't wok x)

    How can I get the int name id?
     
    sepnax likes this.
  2. IntDev

    IntDev

    Joined:
    Jan 14, 2013
    Posts:
    152
    NVM, I found the most obvious Shader.PropertyToID("_Value"); lol
     
    sepnax and Kuptsevych-Yuriy like this.