What you have written is a constructor:
public Player()
{
Debug.Log("health is " + health);
Debug.Log("power level is " + power);
Debug.Log("the name of the player is " + name);
}
Constructorts are the only methods you can declare that have no return type (because they are always called with the
new
keyword, and the system returns the new instance for you).
And constructors can only be created in the class that shares the same name as the method itself:
public class Player
{
public Player()
{
...
}
}
So, either your constructor is outside the class it relates to, or you have forgotten to add a return type:
void
is not the same thing at all!