I need to use multidimensional array
It is said that Unreal Editor does not support it.
Error: The editable attribute does not yet support multidimensional arrays
Uploading: image.png…
I need to use multidimensional array
It is said that Unreal Editor does not support it.
Error: The editable attribute does not yet support multidimensional arrays
Uploading: image.png…
You cannot use multi-dimensional arrays for @editable
. Instead, just use parallel arrays (e.g. one array for each row).
This is code from part of the verse tutorial. I proceeded like this here, but is it not supporting parallel array now? I’d be grateful if you could point me to the parallel array code.
That’s still multidimensional array. Parallel arrays are just a technique where you use two plain arrays, but an index in one array is associated with the same index in another array. For example:
@editable
PropsToSpawn : []creative_prop : array{}
@editable
NumberToSpawn : []int : array{}
In this example, the user/mapper will need to add a Prop to the first array, then a number for how many to spawn in the second array. Both same index. So you will have to have some code to just ensure that both arrays are same length, to guard against common user error. Then do plain counter for loops to iterate, for example:
for (I:=0..PropsToSpawn - 1):
if (PropToSpawn:=PropsToSpawn[I]):
if (NumToSpawn:=NumberToSpawn[I]):
# etc...
It’s a bit tedious, I know, but it’s a viable work-around. You can use this parallel array technique wherever a multidimensional array can’t be used.
Alternatively you could avoid these nested loops by just having an internal multidimensional array, then “load in the values” from the normal arrays once on startup. But I’d only bother with that if you found proof that the multidimensional array was faster.
Anyway, in your case of wanting what looks like a 2D grind, you’d have to one array for each row. Which might be annoying. If you have a fixed size 2D array, however - even one dimension, say the rows; well since you already know the row length you can just use one single array and then “split” that array into multiple ones at runtime, at the row length count.
Hope that makes sense. Yes it’s annoying, but it should get you somewhere at least. Maybe they will improve this one day.