change shader param in multiple instances from gdscript

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

hi, i’m having trouble changing the shader parameter from gdscript. i know this might be a silly question but it is a huge headache for me, so i’m asking it here

here are my scenes

  1. container:
    enter image description here
    the stars node has a script attached which has the following code
func _ready():
	for i in range(10):
		var instance = star_scene.instance()
		add_child(instance)
  1. star:
    enter image description here
    the star node has a script attached which has the following line in the _ready function

    the texturerect node has a material setup like this
    enter image description here

the star.shader file just has this

void fragment() {
    COLOR.rgb = col.rgb;
}

when i run the game, all star nodes have the same color, i want them to have separate color
i have made the shadermaterial unique, still the problem persists

:bust_in_silhouette: Reply From: Inces

I hated this problem in Godot before, now I can gladly share sollution :). There is another parameter required to allow resources to be unique. Look at your 5th posted image, there is Resource tab. Choose it and tag “local_to_the_scene”.

this worked! thank you so much

tshrpl | 2021-12-25 10:24

Exactly what I needed!

qwertmullins | 2022-08-15 15:38