|Topic was automatically imported from the old Question2Answer platform.
I have a script with many other scripts being an extension of it. The parent script has a function that requires a variable which all of the child scripts should have, but at different values. Another, separate script receives the packed scene which contains one of those child script, makes an instance of that packed scene, and calls this function from the parent script. I want the function to use the variable that is in the extension(child). How can I do that?
Sorry, when you say “parent” do you mean parent node in the node hierarchy or the superclass?
exuin | 2021-04-15 20:03
No, I mean the script that is being extended. Parent is probably not the appropriate word, but I don’t know a better one for this.
John97 | 2021-04-15 21:12
exuin | 2021-04-15 21:45
I’ve kind of solved the problem with singletons. Would using superclass be preferable to that?
John97 | 2021-04-15 21:49
It really depends on what the specific problem is.
exuin | 2021-04-15 21:49