As with most nodes, object reference outputs can be directly connected to interface-typed inputs on "make container" nodes (e.g. "MakeArray") if the object's class type implements the interface class.
However, there is currently no cast logic in place to convert the object term to an interface term, so the input remains an object reference term at runtime. This means the VM will only store the object's address into the first field of the FScriptInterface type for each input value, so the interface address field of each element is left as NULL as a result. This is demonstrated by the "invalid" case in the attached project.
By contrast, the "valid" case in the attached project works because Array_Add is a function call rather than a custom node type, and function call nodes already add an implicit cast from object to interface at compile time (see FKCHandler_CallFunction::RegisterNets).
In lieu of a fix, the workaround is to explicitly add a "Cast to <interface type name here>" node in between the object reference output and the "make container" node's input pin (see attached image).
Note: this issue will also be exhibited by "MakeSet" and "MakeMap" container nodes. These are not covered in the attached project, but test cases can be set up similarly.
LogClass: Warning: Invalid InterfacePointer - Object Name (MyObject_1)
Expected result: No warnings appear in the output log.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-175413 in the post.
|Component||UE - Gameplay - Blueprint|
|Affects Versions||4.27, 5.0, 5.1|
|Created||Jan 28, 2023|
|Updated||Mar 14, 2023|