Hi,
So im fighting with interfaces. :rips hair and cryies blood:
_
Lets declare a few classes:
cpp_Interface : aka= IDamageable
bp_Actor : implements cpp_Interface
cpp_Actor2 : implements cpp_Interface
bp_Actor3 : inherits from cpp_Actor2 (and therefore implements cpp_Interface)
cpp_ActorWhatever : calls methods
_
Problem 1
Casting and passing (in a method) interfaces implemented in BP is always null. Whereas if implemented in cpp they are valid. If I check for null in the BP it tells me its not null.
For example, if in cpp_ActorWhatever I try to use:
IDamageable* damageable = Cast(with a bp_Actor); damageable is null.
but
IDamageable* damageable = Cast(with a cpp_Actor2); damageable is valid
IDamageable* damageable = Cast(with a bp_Actor3); damageable is valid
_
Problem 2 (probably the same problem, but illustrated differently)
If in cpp_ActorWhatever I have a method:
void MethodFoo(const TScriptInterface "<"IDamageable â>â & v).
(ignore the ")
Calling it:
MethodFoo(with a bp_Actor): tells me its null
MethodFoo(with a cpp_Actor2): tells me its ok
MethodFoo(with a bp_Actor3): tells me its ok
##CODE: cpp_Interface
UINTERFACE(Blueprintable)
class UDamageable : public UInterface
{
GENERATED_BODY()
};
class TPSMPPG_API IDamageable
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintAuthorityOnly, BlueprintNativeEvent, BlueprintCallable, Category = "Life")
void ReceiveDamage(int32 dmg);
};
God, this formatting is still dung.
Question: how TF am I supposed to declare and use interfaces so they dont return different values whereas implemented in cpp or bp ?
I hope my questions is clear, putting into words and scouring the net for a solution for this weird problem is difficult.
Thanks