Unity Community


Results 1 to 8 of 8

  1. Location
    Chapel Hill, NC
    Posts
    121

    Label Background Color

    I basically just want to create a "color map" - a series of boxes - each filled with a different color. This would be analogous to background-color in CSS.

    How do I do this? It seems that the normal states in skins / styles require a texture (image) - not just a simple color input.

  2. Unity Product Evangelist
    Location
    San Francisco CA USA
    Posts
    6,186
    Yup, so create a set of small (2x2 even) background boxes of the various colors you'd like, then create unique GUI Styles for each color set-up you'd like and away you go!
    Tom Higgins - Product Evangelist at Unity Technologies ApS
    unity3d.com | answers | blogs | feedback


  3. Location
    Chapel Hill, NC
    Posts
    121
    As I make my way through the docs I see that I need to define a GUIStyleState. This has two variables -- background and textColor. Trouble is, background is an image (Texture2d). This is where I get into trouble. I would expect to see a variable called backgroundColor.

    Do I need to define a new "texture" for the color? If so, is there an example of how to do this?

    The "texture" concept is where I get into trouble -- this is a new paradigm for me I am afraid ...

    Thanks!!

  4. Administrator
    Location
    Copenhagen
    Posts
    1,586
    The simplest way would be to use a white texture, then assign the color you want to GUI.backgroundColor. The change sticks around so you should make sure to revert the value when you're done.
    Mathematicians that only do calculations that we already know about and are comfortable with? They're called accountants, and they have no friends.


  5. Location
    Chapel Hill, NC
    Posts
    121
    OK, I know my ignorance is irritating, but this is what I dont understand:

    Where do I get a simple white texture? Is this something I can create in Unity? Is it an image? Where does this come from?

    Thanks!



  6. Posts
    295
    you can create it with any image manipulation program you like. Maybe Gimp or Photoshop


  7. Location
    Chapel Hill, NC
    Posts
    121
    OK, Thanks very much all ...

    For my friends at Unity, it seems that a straightforward backgroundColor - that does not require an image to start with - would be a sensible item for the wish list.


  8. Posts
    295
    yes it would be nice to switch background colors like in Css

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •