Advertisemen
For those of you, who are using C# in unity3D. This short tutorial will show you how to access variables from other class in a vary simple way. You can use the same technique to get other contents from other classes.
For this tutorials, I have created two classes called ClassA and ClassB. So, In ClassA, I have the followings -
In ClassB, I have these.
separator" style="clear: both; text-align: center;">
In this example, simply what I have done is ClassA.score so it is class name and the variable I want
to access.
If you want to have updated informations from ClassA, make sure that you have called the variable in side Update function, like this way.

to access.
If you want to have updated informations from ClassA, make sure that you have called the variable in side Update function, like this way.
Hope this is helpful to you guys. Thank you
Advertisemen
Tidak ada komentar:
Posting Komentar