Quantcast
Channel: Answers by "Peter G"
Viewing all articles
Browse latest Browse all 90

Answer by Peter G

$
0
0
If you're accessing `counter` from a member function in the same class that counter is declared in, then you can access it without a type identifier. Otherwise you need to put the class name before you can access it. And I always use `.ToString()`. I don't know if `js` has an implicit conversion, but C# requires you to explicitly convert one to the other. pietext.text = "You missed " + ClassName.counter.ToString() + " out of 10 questions"; `ClassName` will be the name of the script file (Unity automagically creates a class with the same name as the script file).

Viewing all articles
Browse latest Browse all 90

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>