|
Hello. I found some code on the Unity forums, from the post from GaborD here The code is:
I have gotten these errors: Unknown identifier: 'xxx' Unknown identifier: 'yyy' Unknown identifier: 'colorPicker' Unknown identifier: 'model' Unknown identifier: 'colorPicker' model.materials[matnum].SetColor("_Color",col); So I am assuming this is where you drop the model or prefab I want to control the color of. But how do I do this right? Am I doing any of this right? Should I assign anything to those variables,
(comments are locked)
|
|
Here's the script with the correct variable declarations.
And as GaborD mentioned you may have to adjust the offset values depending on your texture: (215; 55; -9;-5;41;) how do you adjust the offset based on texture? where does the 9 and 41 etc come from?
Oct 29 '11 at 11:55 AM
ina
Did you even read the forum article? Almost everything is explained there. They are some adjustments due to the used GUISkin(margin / padding). quote from "GaborD":
Oct 29 '11 at 01:03 PM
Bunny83
ok, just to be sure, his texture had a 9 offset on the x, and a 5 offset on the y? and 41 was the texture vertical size?
Oct 30 '11 at 07:30 AM
ina
umm, yes:
Oct 30 '11 at 11:35 AM
Bunny83
They're basically magic numbers, you adjust them for your specific application!
Oct 30 '11 at 11:38 AM
syclamoth
(comments are locked)
|
|
there is no need to use "magic numbers" and trial and error here if you use GetPixelBilinear function instead of GetPixel: Note: Make sure your "ColorPickerStyle" has no padding, margin and border; has UpperLeft alignment; and dimX and dimY are proportional to the size of your texture, i.e. it fills the entire Rect - for some reason I think Unity can't correctly stretch a background image of a GUI controller, like a RepeatButton, even with StretchWidth and StretchHeight enabled).
(comments are locked)
|

Did you even read the corresponding text to this script snippet?
This is why you should never just copy-paste something without understanding what it does.
Me applied this to my application and it gets RED color only... Please Help Me Iwas Stucked Here...
@manojprince: Don't post such requests as an Answer. If you have a question ask a Question and be a bit more specific as just "I've tried something and it doesn't work...".