How to make different texture of grabber on N value of slider?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TheVorkMan_

I want make different texture of grabber on N value of slider.
How to make this?
Example:
enter image description here

:bust_in_silhouette: Reply From: GameSchool

Hi

If it helps, you can add the signal value_changed and use an if statement to change the texture of your grabber.
You will have to use self.add_theme_icon_override() for that.

This function has 2 parameters:

  1. The name of the icon you want to override (Look at the options in the override part of the slider node)
  2. The object of the new texture you want to use.

Example:

func _on_value_changed(value):
    if(value > 50):
        self.add_theme_icon_override("grabber", ImageTexture.new())

No, its not working, or I just stupid and dont understand.
I make this:

var var4 = load("res://big/ass/path/to/image.png")
func _on_value_changed(value):
if(value >= VAR2_start):
	self.add_theme_icon_override("grabber", var4)
	self.add_theme_icon_override("grabber_highlight", var4)

TheVorkMan_ | 2023-04-09 18:01

Hi
This code actually worked for me.

Did you connect this function to the right signal?

GameSchool | 2023-04-10 05:34