I’m having a bit of trouble when I convert my script into a class. (java)
HitpointController.js
...
var StartingHitpoints : float = 100;
...
function GetCurrentHitPoints(){
return CurrentHitPoints;
}
becomes
class HitPointCOntroller extends MonoBehaviour {
...
var StartingHitpoints : float = 100;
...
function GetCurrentHitPoints(){
return CurrentHitPoints;
}
}
Once I do this:
- all variables to be set in the Inspector disappear
- functions Awake and Update no longer function.
- I can no longer access the functions from outside the object using the getComponent( “HitPointController” ) command. It throws this error