#The gameobject has the same variable as the other gameobject, even though they have seperate scripts
1 messages · Page 1 of 1 (latest)
Yeah gn
i think the issue is InteractionRadius is running on all flasks instances. so when a 2nd flask is added, after combining the mixture, it is added to all (in this case both) instances . . .
that is why you receive the error. only the current flask should have InteractionRadius enabled to run . . .
or when you press confirm, it should only add to the current flask instance of InteractionRadius . . .
After your exams, create a flask and then fill out the info. Create another flask and then fill out its info. We already know that it errors once, but hypothetically if the first flask is the one that error’d that message, then if you create a third flask you should get 2 error messages from the first 2 flasks (totalling to 3). If that’s the case, then we know that the issue is that interactions are being shared among all of them for some reason. Anyways good luck on your exams!
Back from the dead. You understood me wrong haha. I was practicing for the exams the whole day
Having extra lessons etc
The actual exam is on 24th of may
Yeah thats understandable, I have exams also this week
S'up? 🤔
I don't see your message for some reason @static elk
weird
either way - not sure what to do with that
Which message?
where you said s'up
either way
I have no clue how to fix this
Hm, I have an idea.
Basically a seperate script which would store the values individually
Did you read my previous messages? Log the name of the object right before you add it to the dictionary. That way we can see what object is doing it . . .
you didn't log the name of the object so you know which object is adding it . . .
multiple components are attempting to add to a dictionary. just log the object before you add it to the dictionary. then you will know, that's it . . .
that is the name of the object
So it's adding multiple times on the same one and not each separate one . . .
so what shalt I do
@static elk (sorry for the ping again 😦 )
These objects are created into the scene correct? Why is the dictionary on these objects, aren't they only part of the compound you create?
well, those two simply change their name. They are seperate instances of the flask
Oh, they are originally the flask, but change to the name of the element?
So each flask (or instrument) used to contain the element has their own script with a dictionary, correct?
yup
and yes
Okay, so, when you create the final compound, that compound is added to the instruments' dict, right? (trying to get the process down) . . .
mhm
but here the error appears on the stage of parsing/tokenizing
basically splitting up the equation into seperate atoms etc
The question is: what code is executed when the button is pressed (that creates the final compound)? Because, when it's pressed, it adds to the instrument (flask) dict — this works correctly the first time — but when you create a 2nd flask and press the button to add the compound, it adds it to the 1st flask and receives the duplicate key error . . .
So I would check the button and how it calls the method . . .
nono like
when that button is pressed
the listener activates the rest of the code
in this case it does it for all flasks that have the listener
If every instrument listens to it, they all will attempt to add the compound . . .
so I have to change the method
yup
but the issue now is how to change it so it only works on the flask that has the reaction
That's what I was talking about from the beginning . . . 😂 😂
Hold on, BRB . . .
you can do 2 different things: what i mentioned before was, reference the current instrument (flask) and call the method via the reference; or add the instrument (flask) method to the button listener when it's the current one and remove it from the button listener after using it . . .
uh, what do you mean by the first one?
I think he means add the button listener on the first flask, and after you are done using the first flask, remove the listener
Okay but what if I'll need to reuse this flask? Aka add some more reactants to the flask?
Maybe use a raycast to figure out which flask to add the button listener to
And then store that reference, and once you are finished, remove the listener
hm, maybe
first off, you should really have a manager/oversight class that handles/tracks all the compounds of the equation. when you hit the button to add the compound, it'll go into a list/dict on the manager instead of on the actual instrument. this avoids needing to select the current instrument to add to their dict . . .