I have created a named class and attached it to an gameObject, but I get compiler errors when I try to access things like “gameObject”.
My goal is to use getters/setters with the gameObject script. When I use a default javascript script (unnamed), I get errors when I try to use getters/setters like this:
public function get loadErrorMsg():String{return _loadErrorMsg;}
public function set loadErrorMsg(value : String) { _loadErrorMsg = value; }
I read that it needs to be a named class as in “public class Loader {…” for getters/setters to work. However, when I make it a named class I get compiler errors when trying to access things like “gameObject” as in
_playerGameObject=gameObject;
How can I access “gameObject” and “name” in a named class attached to a gameObject?