Array filled in Properties tab = 0 ?

Post » Thu Jun 21, 2012 9:28 am

As title says. I created an array, initialized in a script then filled it in the Properties tab.

float[] Property MyArray AutoMyArray = new float[10]Debug.Notification("Array[1] = "+MyArray[1])

But in game the notification shows 0.0 for the value. I found nothing in the Wiki about arrays filled this way. What is the problem ?
User avatar
Milad Hajipour
 
Posts: 3482
Joined: Tue May 29, 2007 3:01 am

Post » Thu Jun 21, 2012 10:53 am

MyArray = new float[10]
You can't fill an entire array with a single element call.

Myarray[x] = array[x]
or
Myarray = array
User avatar
Vicky Keeler
 
Posts: 3427
Joined: Wed Aug 23, 2006 3:03 am

Post » Wed Jun 20, 2012 7:07 pm

I don't see the problem... You changed your array from what you had input in the CK to a new array of 10 elements. When a new array is created, all its elements are 0 or none. So your debug message showing "0.0" is expected, since currently all the elements are 0.0.
User avatar
Kortniie Dumont
 
Posts: 3428
Joined: Wed Jan 10, 2007 7:50 pm

Post » Thu Jun 21, 2012 3:43 am

Ha yeah, i get it. It is replacing what i previously put in. So i removed the initialization line and all now works as intended. Thanks you !
User avatar
ANaIs GRelot
 
Posts: 3401
Joined: Tue Dec 12, 2006 6:19 pm


Return to V - Skyrim