How does this code work?
Hello! I've worked on a project recently that had been worked on by someone else too. And on it, they had added this code:
This is the whole class part of the code.
I know how to use it and I know that it creates a static version of the script that I can access from anywhere and change variables from, but I have absolutely no clue how it works under the cover. In my head, I understand that it creates a static version that sets itself as this script when it's called upon. But, when you reference it at different points in scripts, I don't see how it can know what each variable is set at or any of the other information. I'd appreciate anyone who could help me figure this out!
Your answer
![](https://koobas.hobune.stream/wayback/20220613054701im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Scripting Help desperately needed. 1 Answer
How to communicate between scripts and gameobject use tag in unity 1 Answer
Double Jump 2 Answers
java to DEX 0 Answers
My components are disappears 1 Answer