Constants

How to create constants ?

Right now i am using

private static var DEFINE1 = 1

to define some constants, but static mean that share the same memory and not that the value is constant…

Right ?

.ORG

I’m not too familiar with Javascript, but I believe this should work

const DEFINE1 = 1;

That would work in normal Javascript, but not Unity. And yes, static doesn’t mean constant. I think the way you do it is

private var DEFINE1 = 1;

And don’t change the value of DEFINE1. :wink:

–Eric

It seems like im using floats for integers and NOT put decimals into it. :smile:

.ORG