Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Runtime mesh - Randomizing colour

Discussion in 'Scripting' started by gorbit99, Feb 17, 2016.

  1. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
  2. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
    ok, what you are looking for is the Gradient object.

    http://docs.unity3d.com/ScriptReference/Gradient.html

    You build your keys, then evaluate them at a time. So black at 0 and white at 1, means that at 0.5 you get gray... or in your case, dark at 0 and gray at 1 and you eval to 0.5 you get the middle, or you can even build keys based on things like water level, whats below water level and so on.
     
  3. domkia

    domkia

    Joined:
    Aug 19, 2012
    Posts:
    99
    Maybe you could use vertex colors, it's really simple to set them up when youre creating mesh procedurally. If I remmember you can access them with mesh.colors