Difference between revisions of "Talk:Add - Array"
Jump to navigation
Jump to search
→Not working on empty properties
imported>LAITH10 m |
imported>Goggle |
||
Line 4: | Line 4: | ||
But when trying to add a new element on this property, it simply does nothing (array is still empty). Using the same script with no modifications, but filling the array with a "dummy" element via CK suddenly works just fine. | But when trying to add a new element on this property, it simply does nothing (array is still empty). Using the same script with no modifications, but filling the array with a "dummy" element via CK suddenly works just fine. | ||
I haven't tested it on non-property arrays thought. | I haven't tested it on non-property arrays thought. | ||
After some further testing I found the issue: If you have a property array, you have to make sure that it is either assigned a value via CK, or initialise it somewhere in the code (preferably in OnInit()). If you do not initialise the array via CK with at least one element, the array will be none and thus no functions such as Add() will work. | After some further testing I found the issue: If you have a property array, you have to make sure that it is either assigned a value via CK, or initialise it somewhere in the code (preferably in OnInit()). If you do not initialise the array via CK with at least one element, the array will be none and thus no functions such as Add() will work. |