0 votes

Question.... I have 2 separate scenes/scripts. The 1st scene/script lets call S1, and the second scene/script lets call S2. So far so good. S2 scene/script gets info from a json file and stored into a dictionary in the script. So lets call the dictionary in this S2 cene/script "DictInfo". The S2 scene/script is dynamically created, there could be anywhere from 1 instance up to whatever amount. Every instance of S2 can send a signal which contains the "DictInfo" dictionary and each instance of S2 is connected to the same signal which is heard by the S1 scene/script. Ok so far. So lets say you click on one of these S2 generated scenes, a signal is sent to S1 and runs a function, lets call this functiion "runthiscode()". Now here comes the problem, ALL the dictionaries from all the instances of S2 are sent to S1 to the _runthis_code() function, how can I get ONLY the dictionary from ONLY the S2 I clicked on? Please help, please? Thank You!

Godot version 3.2.3
in Engine by (44 points)

1 Answer

0 votes

I am not sure if this is a connection problem

You are saying that clicking one instance of S2 provokes every other S2 to emit their signal.
I can see two possible causes of that :

  1. Clicking mouse on S2 is not made private, every S2 scene share the same input event.
    If so, than You just have to specify which one is active at the time, for example by activating it on-mouse-entered, and only in this condition letting it to process input

  2. You use global dictionary variable and all instances of S2 share only a reference to it, so it only looks like every instance is sending their info, but in fact it is one dictionary being affected every time single S2 changes something in it local dictionary
    If so, than You should use global dictionary duplicate() in local S2 script

by (2,428 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.