I cannot, for the life of me, get my variable recognized in another script. Please don't say just read this, because I have. Here is my code.
static var population = 120;
static var happiness = 60.0;
static var food = 500;
function Update ()
{
if (population > food)
happiness -= 0.01 * Time.deltaTime;
}
And my second script,
var farms = 4;
var harvest = farms * 10;
function Update () {
food = food += harvest * Time.deltaTime;
}
EDIT:
When they are static my variables don't even show up,
They work just fine when I have them as normal variables though.
Sorry, I'm new to scripting and am kind of terrible at it. Trying to get better though.
EDIT: Alright I now have it showing up but the second script doesn't work now! And I have no errors! Please help. Here's the code.
var population = 100;
static var food = 500;
var foodvalue = food;
var happiness = 60.0;
function Update ()
{
if (population > food)
happiness -= 0.01 * Time.deltaTime;
}
and the second script:
var farms = 4;
var harvest = farms * 10;
function Update (){
PopulationScript.food += harvest * Time.deltaTime;
}