But it won’t work for things like an array of FTransform. (I’ve also tried TArray<UStruct*>.)
UFunctions don’t seem to like templates so I’m not sure how to achieve this here.
Essentially, I want something like the ADD function which will take an array of anything. How can I
Please note, that support of templates in function arguments is quite limited now. Thus, this behavior should be handled at the node level. There is a wildcard pin type UEdGraphSchema::PC_Wildcard, which can be used to provide template-like functionality for array functions. When something is connected to a wildcard slot, the appropriate type is set for the rest of the wildcard dependent pins.
It is possible to make a custom subclass of UK2Node_CallFunction, and then allocate a wildcard parameter. In NotifyPinConnectionListChanged() function, you can determine if the pin that was connected was a wildcard and search for an UFunction for appropriate type, and then call UK2Node_SetFromFunction. This way, template-like behavior can be implemented.
However, there is also a way to receive wildcard parameters (USTRUCTs) without creating custom nodes. If you like to learn more about it, please go here:
How would I change this to work for arrays? Or can UProperty be an array?
The code also uses ‘UArrayProperty’, can that be used as ‘any struct array’ similar to TArray<Uobject>?
I, unfortunately, won’t have time to try any of this till tonight but thank you for the help.
It’s been years since I’ve looked at it so I can’t say for sure. I think I just made alternate functions that matched the type (I guess overloads didn’t work either).
I’ve attached most of the code so maybe that helps, maybe it doesn’t.