How to edit color of selected object?

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

If selection changes the color of selected object then how to edit it?
I ques could be some other way to select object to be able to see actual changes of the color in real time.

:bust_in_silhouette: Reply From: RakuNana

To edit colors via the script use $YourNode.modulate = Color.WhateverColor.
example code:

extends Sprite

func _process(_delta):
      if Input.is_action_just_pressed("ui_accept"):
		self.modulate = Color.red

This code will turn my sprite to a red color! The self keyword is referencing the sprite node.

I’m assuming of course this is what you’re asking :slight_smile:

Keywords modulate and Colors will effect the color of the node you tell the script to change. Just a side note Colors is spelled with a capital! And modulate only works as an extension to a node!
Best of luck!