Download

Blueprint Sets - How to get the values

Here’s the basic information about them

All the basic functions are fine but what about obtaining values? How do I get a value form the set? It is a unique and disordered list, can I get al least the first or the last value and then delete it?

Should I have to convert to array every time I want to get its elements?

There is no first or last in a set. It’s a sack of marbles, you know what you’ve added but now it’s all jumbled up.

image

When you work with a set, you have expectations about the content, so you request something very specific. All you get is whether it was contained or not:

image

Should I have to convert to array every time I want to get its elements?

If you’re working with a set, you already know what you’re looking for. The best you can do is to check if it’s there. But yes, if you want to actually iterate through content, it needs to be turned into the sluggish array again.


Perhaps you wanted to work with this instead:

image

A regular array but guaranteed to not have duplicates when used like this. Now you can get first / last element.

1 Like

Wow thanks for the detailed answer! I thought sets where some sort of first in first out data container. Anyway I’m just starting and based on your explanation I’d rather stick with arrays for now, which I have tested with int, string and custom struct. Array + AddUnique will do the trick just fine.

Now that I have some flow control and data management I’ll start playing with basic objects. Then with the first/third person examples. Thanks again for your help.

There’s also a Map

Which allows you to fetch stuff with a unique Key.

Oh it’s like a dictionary, this can be very useful :+1:

Yup, they actually call it a dictionary in the engine:

image