Javascript Custom Classes

Ok so I have a question. I have a script with some custom classes on it. So in other scripts I can use those as a variable type and it works. Ar there any tutorials on custom classes? And for some reason when I have a function in one nothing happens? Any idea? I trigger it but nothing happens.

var YourCharacter : Character = new Character();
YourCharacter.CheckHealth();
#pragma strict
class Character //A playable Character
{
//stats
	var Name : String;
	var Health : float;
	var dam : float;
	var armor : float;
	var stam : float;
	var sight : float;

	function CheckHealth(){
	print("Checking Health");
	if(Health < 2){
	print("Character is died");
	}
	}
	
}

Why is the function not triggerd?

The function IS triggered, but you’re using “print” that is a static function of MonoBehavior class, just replace it with Debug.Log() or MonoBehaviour.print()

If the function isn’t in the same script or attached to the gameobject you want to access it from you must use either getcomponent or addcomponent and then you can access it

To add to what Franscesco said, you can also extend:

class foo extends MonoBehaviour
{
}

And then print, plus all the usual behaviour will work.

Thanks Yall!