Changing shader property for one object makes it to all

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

(Using MouseEntered() and MouseExited()) When hovering the mouse over a card, it plays an animation that moves it upper a bit and change the alpha value towards 0 or 1, depending whether I need it shown or not.

The hovered one behaves at it should be, the problem comes when every single card plays the shader animation only. So I must assume that the problem is how I’m changing shaders properties. I’m changing it using the AnimationPlayer node, and changing the alpha value from the colour pick within the shader properties.

Just for clarification, because maybe this might be the cause of the problem as I read about “singletons” and sounded like so. The way I handle different types of cards consists in an only card template, that holds the AnimationPlayer node and the behavior script all sorts of cards must run. For every different type of card, I create a new scene, add a new instance to the template card, and a config node that runs when the button is pressed. I autoloaded a scene that has a export (Array, PackedScene) var upgrades variable witch loads every card randomly from this array.

1 Like
:bust_in_silhouette: Reply From: Inces

This is just how shaders and materials work. They are resource data type, so they are shared by all instances by default. To undo this, You need to get to material properties in editor, find resource tab, and tag local_to_the_scene

1 Like