Im getting the error “BCE0024: The type ‘unit’ does not have a visible constructor that matches the argument list ‘(UnityEngine.GameObject, float, float, int)’.” for the following code:
var attack : float = 1;
var defence : float = 1;
var hitPoints : int = 3;
var unitStats : unit = new unit (gameObject, attack, defence, hitPoints);
With this class-code:
class unit {
var group : GameObject;
var type: GameObject;
var attack : float;
var defence : float;
var hitPoints : int;
var currentHP : float;
var model : GameObject [];
function team(typ : GameObject, att : float, def : float, hp : int){
type = typ;
attack = att;
defence = def;
hitPoints = hp;
currentHP = hp;
}
function team(grp : GameObject, typ : GameObject, att : float, def : float, mod : GameObject[], hp : int){
group = grp;
type = typ;
attack = att;
defence = def;
model = mod;
hitPoints = hp;
currentHP = hp;
}
I have no clue what would be the problem as to me it seems like it would be working match with the first constructor. What am I missing?