Temperature Slide

I'm working on learning programming and currently working on an educational project that I'm having some problems trying to figure out the best way to start building controls. I've been looking around for something similar to what I'd like to add to my project; however, I've had no luck.

I'm looking for some guidance in creating a gui slider. When the user move it, the temperature rises and the cubes change colors as well, such as the one found on www.ptable.com. Their sliding bar functions how I'd like mine to look, and maybe even include the option of allowing the user to enter in a number and the boxes match that temperature.

Any help would be wonderful and much appreciated. Thank you!

The slide bar and text box you can do with existing components in the GUI class. You should take a look at http://unity3d.com/support/documentation/Components/GUI%20Scripting%20Guide.html for more information on how to use Unity's GUI system.

For the element squares I would make a custom class that included a compound GUI setup which you could initialize with things like Gas, Liquid, Solid temps as well as the basic information about the element. Then create an even for this class which updates the current temperature. When you change your slider or text value simply call this method on all your elements and have them update their state accordingly.

I just picked this part of my project up again and got the color part of it figured out. There's another script for the slider (TempColorSlider.js) that works for the project is based off the one found in the GUI guide. The one shown below is attached to all 118 gameobjects.


var gas = Color.red;
var liquid = Color.blue;
var solid = Color.black;
var unknown = Color.gray;

var melt = float;
var boil = float;
var noData = float;
var temp = float; 

function Update() {
     temp = GameObject.Find("ObjectHolder/Change").GetComponent("TempColorSlider").sliderValue;

     if(temp < melt){ 
        renderer.material.color = solid;
    } else if (temp< boil && temp > melt) { 
        renderer.material.color = liquid; 
    }  else if (temp > boil) { 
        renderer.material.color = gas; 
    } if (noData > -1){
          if (temp >= noData){
        renderer.material.color = unknown;