- Home /
Question by
allenrobot · Jun 08, 2017 at 03:32 PM ·
javascriptarraydecimalfloatingpointinitialisation
How to allow unityscript to see Decimal[]?
import System; <---this is up top at start btw.
var testarray : Decimal[];
testarray = [35.0,-3.3,4.0,18.2,-4.0,1.9];
ERROR GIVEN:"Cannot convert 'float[]' to 'System.Decimal[]'."
P.S. Same issue if casting them as Double[] and then filling with same numbers unless I put a "d" after the filled number for each.... So, what is the secret code letter to designate a decimal type?
I want to use higher precision math for more accurate output. (for DOD use). Looks like it is assuming anything with a decimal point is just a float and throwing this error. Do I need to type 30 zeros after the decimal point in each array position number? Because that would seem ridiculous to me.
Comment
Answer by OldManSmithers · Jul 04, 2018 at 03:51 AM
Just for anyone else coming across this question - the answer is to put an "m" after the number ---> 20m, 30m, ect.