I have custom data struct, which I want to pass trough parameter in RPC.
It’s nothing complicated:
USTRUCT(BlueprintType)
struct FGAEffectHandle
{
GENERATED_USTRUCT_BODY()
protected:
UPROPERTY() //we will replicate handle, so we need it be uproperty.
int32 Handle; //Fname Guid ?
public:
FGAEffectHandle()
: Handle(INDEX_NONE)
{}
FGAEffectHandle(int32 HandleIn)
: Handle(HandleIn)
{}
bool IsValid()
{
return Handle != INDEX_NONE;
}
inline int32 GetHandle() const { return Handle; }
static FGAEffectHandle GenerateHandle();
bool operator==(const FGAEffectHandle& Other) const
{
return Handle == Other.Handle;
}
bool operator!=(const FGAEffectHandle& Other) const
{
return Handle != Other.Handle;
}
friend uint32 GetTypeHash(const FGAEffectHandle& InHandle)
{
return InHandle.Handle;
}
};
When this struct paremeter is passed as param in RPC, Handle value is -1 (while it should be >0).
Out of curiosity I checked how unreal types are passed trough RPC, and they work correctly. Which means I have to tell engine, how to handle my own types.
Any idea where to start with it ?