How to populate an aray of type Enum

Hi there,

i’m facing a small issue because i’m new to the engine ,…

… basically i want to populate an array called “Faction Array” with an Enum type and give each Enum at each index of that array a different value of the Enum ,i mean choose a different name from the Enum 3 name choices which are “Darkpiece” , "BrightPiece "and "EmptyField " shown in picture below …,…

… and I want the array of this type Enum to hold the Enum value set to “DarkPiece” from index 1 up to index 15 of this array , and to hold “EmptyField” value from index 16 up to index 47 , and to hold “BrightPiece” value from index 48 to index 63 … cause my array length is 64 .

in picture below i’m trying but with no result …So anyone knows how to achieve that or is it even possible !! …???..

Thank you for your support , appreciated .

Your array is of size 64 already, Adding new elements will make it grow bigger.
Use Set Array Elem node (with SizeToFit) to set index to the desired value.

Or do not resize it initially and then just Add as you’re doing it already.

You can do it manually in the editor, too, of course :wink:

And you can avoid cascading branches in your case by doing something along these lines:

For safety if you are just adding you may want to use the clear array node instead of the resize.
Once you’ve added all the elements back in it will be size 64 again

Thanks gays ,

yeah it was dumb from me to resize to 64 when i’m already adding the 64 elements , so i just removed the resize part and it works fine with branches , but the above mentioned script is cleaner and easier to read i’ll be using it instead of repeating the branches …