Just wondering if it’s possible to have a generic array parameter to a function like the Get or Last Index functions have for arrays.
For example, I want to write a function that returns a random item from an array but with the current implementation I would need to write a function that takes an array of strings, array of ints, etc. that all do the same thing.
Am I missing something or is this just not possible in blueprint?
You can do that in C++ via templates, but not in blueprint, blueprints don’t support such concept (yet?) and if you look on engine blueprint APIs they also use multiple nodes for mutiple types. The array operation nodes is custom coded nodes that accept any array which code you can see here:
But i think doing 5 types (int, float, object, vector, rotator) should be sufficient for you, do it’s not that tragic
Thanks for your reply.
It would be more than 5 types, if you want to write a generic function library it could get messy pretty quickly but I guess C++ is the way to go then.
They have added support for this in blueprints now. You can now use the wildcard data type.