Hey everyone,
So I’ve been working on some code on my breaks at work and wanted to plug it into Unity. Trouble is, when I try it out by typing it into notepad, saving it as “.js” then running it on IE (again, work computer), and the code works fine. Then I try running it in Unity and it gets an error.
Here’s how I have it in Unity:
function Start () {
//Core Stat - these will determine the overall abilities of a character.
var coreStats={
str : 0, //Strength
agl : 0, //Agility
int : 0, //Intelligence
per : 0, //Personality
prc : 0, //Perception
end : 0, //Endurance
wil : 0, //Willpower
lck : 0 //Luck
};
}
And I get told that str and the others are an unknown identifier.
in my .js i have it written:
<!DOCTYPE html>
<html>
<body>
<script>
var coreStats={
str : 0, //Strength
agl : 0, //Agility
int : 0, //Intelligence
per : 0, //Personality
prc : 0, //Perception
end : 0, //Endurance
wil : 0, //Willpower
lck : 0 //Luck
};
</script>
</body>
</html>
and it works fine.
What am I not doing or doing wrong here?
Thanks!
EDIT: Oh, I should also mention that I forgot Unity already uses “int” and have already changed it.