Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | pqr |
class_name Player
extends Resource
export var eye_color = [0, 0.5, 0.5] # HSV
export var hair_color = [0, 0.5, 0.5] # HSV
func ec_hue_change(value): # connect with a hslider maxvalue 360 step 360
print(eye_color, hair_color) #[0, 0.5, 0.5][0, 0.5, 0.5]
eye_color[0] = value # slide to 360
print(eye_color, hair_color) #[360, 0.5, 0.5][360, 0.5, 0.5]
emit_changed()
func hc_hue_change(value): # connect with another hslider maxvalue 360 step 360
hair_color[0] = value
emit_changed()
# sliding this hslider doesn't print anything but both var is changed
^^^ why is this happening?
I tried change export var eye_color to [0.0, 0.5, 0.5] (eye_color[0] is now a float)
and it’s work why is that?
Use Color.from_hsv(0, 0.5, 0.5, 1)
instead of lists.
(and format code in your questions properly (there is a button for it))
USBashka | 2022-08-04 13:08