• Godot Help2D
  • How to revert "modulate" property to defaul value?

Hell godot spcialists!
I've change the modulate to Color.AQUAMARINE, now I need to return modulate on object to default, how can i do this?

I've always done this by simply storing the original value in a variable, ready to reassign when needed. I'm not sure if there's a better/different way though.

    _Stephen thx for your ultra-fast answer.
    I thought it can be done by some function like reset_to_default() or something else... but ok, will resolve it by your variant

      For someone who come here for answer: default value for modulate is Color(1,1,1,1) you can define it as
      const DEFAULT_MODULATE = Color(1,1,1,1)
      and use when you need it to restore defaults for modulate property

      finfan You could get the default value programmatically by creating a new instance (of the same node) and read its modulate value:

      self.modulate = Sprite2D.new().modulate

      (Yet, this seems to be a lot of overhead compared to the two solutions suggested above.)