|
Hey there! I've tried my hands at creating something like this. If you haven't used photoshop and don't understand what's happening from looking at the pictures I'll try to explain it: There are 3 sliders. Red, green and blue, all of them have a gradient applied to them from Color(0, 0, 0) to COlor(red, green, blue). They also each control the value of their color, so I want the slider to function as a slider would and simply change the background image in real-time. Here's what I tried (with horrible results) Horrible as in it freezes. The documentation told me that Apply() is expensive but I don't know how else I'd go about doing this. Any ideas? Here's the slider code in case you'd like to know: I made a gif just to clarify: http://i.imgur.com/LshWC.gif Edit: I also fixed the broken code... Sorry for the confusion
(comments are locked)
|
|
Christ now I feel stupid... I changed it to go between 0 and 1 instead. I'm used to XNA and they used 0-255. The crashing also came from me using the wrong format. I changed it to ARGB 32 bit and it worked.
(comments are locked)
|

umm .. WHAT IS IT you're trying to change?
a 2D square of color? A dinosaur? what ?
FTR this sort of thing is trivial with the beloved 2DToolkit, you just do this:
so that's one easy solution.
A 2d square of color indeed. I thought I gave enough info to convey that, but yes.
Color needs values between 0 and 1, try changing your slider values
http://docs.unity3d.com/Documentation/ScriptReference/Color.html
OR, you could divide the value by 255 in SetPixel
nice GIF =]
Did you look at changing the slider values from between 0-255 to 0.0-1.0 ?