Answer the question
In order to leave comments, you need to log in
What needs to be written so that the script has access to variables from other scripts?
Good day
There are two scripts, the first one contains a variable, the second one should execute the if loop with the variable from the first script. However, he considers it non-existent.
What needs to be written so that the script has access to variables from other scripts?
Answer the question
In order to leave comments, you need to log in
If there is already a link to the script instance, then make the variable public (Public). Well, or write a getter.
If there is no instance, get it. There are a lot of options here - DI, creating one from the other, SerializeField, etc.
Read Sharpe books. It will be tough without him.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question