Are hard or soft references better when looping?

I see a lot of articles praising soft references, but I’m wondering if I should really use them.

If i run a function on an array of class references in a loop, a hard reference is all i need, but a soft reference requires an additional load and cast.

Does this really provide a performance benefit?

1 Like

Soft references are not for performance, they are there to avoid loading things into memory when it’s not needed.

If you’re definitely going to be using a certain class in a BP, just use a hard ref.

The time you need soft refs are when you have a list of different classes, but you don’t know up front which one you will use when you run the blueprint.

1 Like

Its uses seem to be quite limited. It was quite different from what I imagined.

1 Like

Yup. It’s not for efficiency, it’s to avoid loading things you don’t need.

Use Interfaces when possible over casting & references. You can create interfaces functions that return values from the interfaced class.