I have been looking around for a way to fix it but I dont really understand what is wrong with my code. I have a class for units in a RTS and another class that contains the information about units (I set all the parameters to 0 in an awake()and in the update() the parameters are set accordingly to the unitClass with a switch.
public characterParameters stats = new characterParameters();
public int unitClass;
public float moveSpeedNow;
void Start ()
{
stats.unitClass = unitClass;
}
Later on I’ve got the following:
if (destinationDistance < .5f) {
moveSpeedNow = 0;}
else if (destinationDistance > .5f) {
moveSpeedNow = stats.speed;}
The errors are at stats.unitClass = unitClass and moveSpeedNow = stats.speed .