Answer the question
In order to leave comments, you need to log in
Static instance of the Monobehaviour object?
Please tell me, I found an example of a class that can be accessed from anywhere by creating a static entity of this class in the Awake method.
public static GameClass instance = this;
From any other class, you can now access the public methods and properties of this class.
GameClass.instance.SomMethod();
Similar to a singleton, but without uniqueness checks.
What are the disadvantages of such an approach? Is it possible to do so?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question