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

Color Picker

Discussion in 'Shaders' started by marty, Apr 27, 2008.

  1. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Heya, Shaderheads!

    What code would I use in a Shader script to have the property inspector display a clickable color picker for a float4?
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    You most likely wouldn't write any shaders. You would just author a nice texture palette and then use GetPixel when the user clicks on the texture. If you want to be fancy you would generate the texture from code on the fly.
     
  3. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Good point, Joe, not in the Shader but in the calling script for it.

    Also, I'm looking to do this in the editor, not at runtime.

    So, I guess what I'm asking isn't really a shader question per se, so much as a Javascript question.

    That being said, is there a way that I can script a to put a click-on chicklet that brings up the system picker? Such as the Background Color parameter for a camera object does?
     
  4. thylaxene

    thylaxene

    Joined:
    Oct 10, 2005
    Posts:
    716
    Code (csharp):
    1. var myColour : Color;
    is that what you mean?

    Cheers.