Unity Warning preventing mechanic

I have been trying to look into this bug for a while and can’t seem to find a solution, so I am posting here to get some help. Now, I will say that I am not interested in a direct fix per se, but as I am new to coding still and Unity in general I am more interested in an answer that also explains why this happened so I can try to avoid it in the future, so here goes…

I am building an incremental game that, when clicked, will hire a Punk (granted they have enough requirements) when they hire the Punk it is supposed to increase the total amount of income by say 0.02 (What I have right now). The problem I noticed is that when he is hired, the “PunkH.increase” doesn’t get added, so I am unable to use it for the proper math… It isn’t an error, but a warning, either way it needs to be dealt with so I can create this game… warning says “BCW0028: WARNING: Implicit downcast from “Object” to “int”

Here is the relevant code:

var PunkH = new Hire (10, 0.02);
var Punk : int = 0;


class Hire {
  var cost : int;
  var increase : int;

  function Hire (cost, increase) {
  this.cost = cost;
  this.increase = increase;

  }

}

If there is anything else needed please let me know and I will try to provide as much information as I can. Thanks for the help!

It’s simple, you’re not giving a type to your cost, and for antoher problem try to change your temp variable. Well, like this :

var PunkH = new Hire (10, 0.02);
var Punk : int = 0;

class Hire {
  var cost : int;
  var increase : int;

  function Hire (_cost : int, _increase : int) {
      this.cost = _cost;
      this.increase = _increase;[/INDENT]
  }
}

OK, I think I understand this… Thanks very much.

EDIT: So this took the warning away and does seem to work for Cost, but it isn’t working for increase, I tried switching it to a float thinking that it was because ints don’t take decimals, but that didn’t help either.