Search Unity

Shader values?

Discussion in 'Scripting' started by dacloo, Aug 1, 2007.

  1. dacloo

    dacloo

    Joined:
    Jun 30, 2005
    Posts:
    469
    Hi!

    I have queried a material in a script, and now I'd like to adjust it's shininess through scripting. How can I do this?

    e.g: myMaterial.shader.shininess=0;

    Couldn't find it on the forum and in the docs..
    :oops:

    thanks!
     
  2. metervara

    metervara

    Joined:
    Jun 15, 2006
    Posts:
    203
    This should do it:

    myMaterial.SetFloat("_Shininess", 0);

    /P
     
  3. dacloo

    dacloo

    Joined:
    Jun 30, 2005
    Posts:
    469
    great! thanks! I'll look at other properties like Main color too!
     
  4. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    If you switch the inspector to debug mode, you can see the names of all properties of a material