x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 .alt text

Product Version: UE 4.19
Tags:
more ▼

asked Jul 08 '18 at 11:55 PM in Blueprint Scripting

avatar image

Carter10
19 3 6 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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 ;)

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

alt text

capture.png (139.5 kB)
more ▼

answered Jul 09 '18 at 07:29 AM

avatar image

Everynone
14.8k 77 25 62

avatar image HarryHighDef Jul 09 '18 at 01:13 PM

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

avatar image Carter10 Jul 10 '18 at 08:46 PM

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 .....

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question