Search Unity

Material name?

Discussion in 'Scripting' started by cursed1cursed1, Dec 3, 2013.

  1. cursed1cursed1

    cursed1cursed1

    Joined:
    Jun 30, 2013
    Posts:
    18
    i have four numbers textures/material and four cube
    set random material cube
    but i don't know how to get number when click the any cub
     
  2. cursed1cursed1

    cursed1cursed1

    Joined:
    Jun 30, 2013
    Posts:
    18
    i want click cube and get texture/material number on the cube
    how to get it
     
  3. jdams

    jdams

    Joined:
    Sep 13, 2010
    Posts:
    64
    If your textures are labelled "texture 1, texture 2, texture 3...." then you can use this:
    Code (csharp):
    1. renderer.material.mainTexture.name
    This will give you the name in a string format to tell you which texture is used.
     
  4. cursed1cursed1

    cursed1cursed1

    Joined:
    Jun 30, 2013
    Posts:
    18