Java Inheritance Issue

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

I believe I figured it out: Java classes extend MonoBehaviour by default. Doing it again seemed to be causing the problem.

I was able to do

class HitPointController_Zeppelin extends HitpointController {

var somethingNew : GameObject ;

	function Awake() 
	{
		print( "HitPointController_Zeppelin" );
	}
}

I see the variable somethingNew in the Inspector and my print out appears correctly as well.