Visual Scripting - Prefabs handling of object variables. Any solution?

Hi,

If you have a prefab with these 2 variables:

PrefabID does not change because it is the ID of the prefab.
But SpecificValue will be different for each instance of the prefab in the environment.

Let’s say I place 50 instances and I set their SpecificValue to different values.

Then I figure out that I need to add a new variable in the prefab:

The NewVariable will not be inherited by 50 the instances. It seems that the link of the Variables component with the prefab is broken because the value of one variable was changed.

So I see 2 ways to handle this, and both are tedious:
1- Going through the 50 instances, reverting the Variables component and setting again the SpecificValue.
2-Going through the 50 instances and adding the NewVariable.

I tried a 3rd possibility, but it does not work. In the prefab, I created a second Variables component.
The idea was to put all the variables that will not be modified in the first component (the link with the prefab will not be broken), and the variables that need to be specific to the instance, in the second component.
So at least, if I need to add a new variable that is not specific to the instance, I could add it in the first component and it will be inherited by all the 50 instances.

However, all the variables that are in the second component are ignored by the scripts and I get an error saying that these variables were not found, even though they are there in inspector.

Any solution/workaround to handle this?

Thanks

1 Like

Hi,

Is no answer means no solution or workaround?

Thanks

Still waiting…

we are currently having a similar issue. Did you ever find a solution?

The only workaround I found is to create a new game object for the specific variables, and even in some cases, 1 new game object for a new variable. Really not ideal, but at least the new game object will be created in all instances of the prefab with its the attached variable.

I have the same issue. I am still in the beginning, but I imagine I will need more variables later and I can not think of all of them to prepare in advance. So it is important to be fixed.