Hi there! So I have these objects called Circle 1, Circle 2, Circle 3… (prefabs) and each one of them has a script and a flow machine with visual scripting.
In the visual scripting I created a Boolean and I want to access it from the script in the same object to check if it’s true.
I’ve followed these simple instructions
And the important part of the code is finally this:
var Negative = (bool)Variables.Object(Circle).Get("Negative");
if (Negative){ return; }
Does not work this way because it gives me this error:
“The name ‘Circle’ does not exist in the current context”
So I solved it, like says in that link with the instructions, by adding at the beggining the object reference:
public GameObject Circle;
The error disappears but is not working. I supose it does not because the object name (that contains the script) is not only circle, they are prefabs, more than one in the scene, so one is circle 1, other circle 2, circle 3, etc.
The console error gives me this:
UnassignedReferenceException: The variable Circle of CircleController has not been assigned.
You probably need to assign the Circle variable of the CircleController script in the inspector.
Do you know a way to do that? Maybe telling the script to access the variable that is in the same object as the script? So sorry, I’m a game designer that started to study visual scripting and sometimes code seems like hieroglyph to me.
Can somebody help me? Thanks for your time and support!!