Problem with shaders

I am making a school project and i have a problem with shaders. My game its about cards and i wanted to gave them a hover animation, but the animation its applied to all the cards, not just one. Can someone help me? I think the reason its that the card shader itself changes. How could i fix it?

Shader is a Resource, if you use the same shader or instance the cards from the same scene you need to make the shader to be unique in every node otherwise they will receive the same changes even if you change just one

Thank you very much! Do you know how i could instance more shaders?
func on_mouse_entered()->void:
card_ui.panel.set(“theme_override_styles/panel”, card_ui.HOVER_STYLEBOX)
card_ui.container.material.set_shader_parameter(“Shader”, FAKE_3D)
i tried that but i guess i should create it coding

The material you apply to the geometry should have it be Local to Scene located under Resource and see if that helps.

1 Like

Also to complement what @roc4u1000 said, to do that by code you need to duplicate the material to create a new one:

func make_materials_unique():
	# Lets assume you have a node called cards_pool to hold your cards nodes
	for card in get_node("cards_pool").get_children():
		# Create a new and unique copy of this material
		var new_material = card.material.duplicate(true)
		# Apply the new material for your node
		card.material = new_material
1 Like

Thanks a lot man ^^