Instances of Scenes share their vars

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

I want to make an item system where i can place an Item scene in my level and just set an id and amount var of the item in my inspector (i used export for the vars).

The problem i have is that the amount of every instance in my level gets set to the value of the last loaded instance.

for example:
i have 2 items Item1 and Item2

Viewport:
Item1: amount = 3
Item2: amount = 6

when the scene finished loading both Item1 and Item2 have amount == 6

Is there any possibility to make my vars local to that specific instance?

:bust_in_silhouette: Reply From: Monke

ok i found the issue you have to duplicate the values →

var a = a.duplicate()