It should be possible to create a function that accepts an array as a parameter. What is the exact error you get when trying to compile with the UFUNCTION() in place?
The error is:
TScriptInterface’ : unspecialized class template can’t be used as a template argument for template parameter ‘InElementType’, expected a real type
Also edited the question, realised it had butchered the examples since I didn’t have them as code segments, you should be able to make more sense of the examples now.
Hey ,
Thanks for the link, though the issue here isn’t to do with the interface set-up. The interface is set-up and exposed to blueprint all fine, I can call it’s functions etc. This is more specific to passing a reference to that interface, and more specifically again an array of them.
The following code for instance works fine to pass a single reference of an interface:
After further investigation it seems that there is a bug with passing an array of interfaces into a function. This bug has been recorded for further investigation (UE-21971).
I have entered a bug for this issue (UE-21971) and noted the increased interest in a fix. Unfortunately there isn’t a workaround for passing an array of interfaces at this time.
This issue is still open in our database. I have added a comment to the bug report to indicate that this is still affecting people and will update here when there is a change in the status.
You’re right - I didn’t initially notice that it complained about not finding reference type. Changing my functions to use reference instead of value fixes it. Thanks
So I’ve just encountered this problem again yesterday. This time I decided to take a closer look and see what I could do to fix it once and for all. As it turns out only very few lines are needed to handle this specific case.
I’ve submitted a Pull Request #2468 with the necessary changes.
If you don’t want to wait, here is the commit
Edit: forgot to mention, my change is based on the 4.11.0 release branch