Description

FInterfaceProperty::SerializeItem (and ImportText) attempt to determine if the passed in object implements the interface in question. They do this by calling GetInterfaceAddress, which tries to get a pointer to the interface portion of the object itself. There are 3 cases:

  1. For a blueprint-defined interface, there is no C++ representation at all so it just returns the object
  2. For a native-defined and native-implemented interface, it returns a pointer to the offset where the native-implemented interface lives
  3. For a native-defined but blueprint-implemented interface, it returns nullptr because in this case the C++ representation is missing. This case is only possible for interfaces that don't actually have any BlueprintCallable functions

The case breaking here is #3, and serialization should probably use a different function to verify that it can be properly set. This code is quite old and predates TScriptInterface, which allows safely storing objects that bp-implement a native interface

Steps to Reproduce
  1. Create a native interface IMyInterface and create a blueprint that implements that MyImplementer.
  2. Create another blueprint MyReferencer that has an IMyInterface variable.
  3. Add a MyReferencer instance and a MyImplementer instance to a level.
  4. Try assigning the MyImplementer instance to the MyReferencer variable.
  5. You get `InterfaceProperty /Game/Lighting/Blueprints/MyReferencer.MyReferencer_C:NewVar_0: specified object doesn't implement the required interface class 'IMyInterface': /Temp/Untitled_1.Untitled_1:PersistentLevel.MyImplementer_2`

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-133116 in the post.

0
Login to Vote

Fixed
ComponentUE - Gameplay - Blueprint
Affects Versions4.265.0
Target Fix5.0
Fix Commit18163067
Release Commit18163067
CreatedOct 28, 2021
ResolvedJan 13, 2022
UpdatedFeb 3, 2023
View Jira Issue