I’m trying to pass a structure or class with some basic data to a NetMulticast function but for some reason the compiler refuses to recognise the class.
Here is the data struct / class:
.h (empty .cpp file)
class SPACECOOP_API CustomNetInfo
{
public:
};
struct SPACECOOP_API TestStuct
{
int32 testint;
};
and Here’s how i’m trying to call it:
UCLASS()
class SPACECOOP_API ACombatGameState : public AGameState
{
GENERATED_BODY()
TestStruct mytest;
// spawn projectile
UFUNCTION(Reliable, NetMulticast, WithValidation)
void MulticastSpawnProjectile(FVector SpawnLocation, FRotator SpawnRotation, FVector Velocity, double server_time_spawned, TSubclassOf<ALinearProjectile> Projectile, TestStruct info);
...
I get “error : In CombatGameState: Unrecognized type ‘TestStruct’” on the line with the function definition. The line further up (TestStruct mytest; ) seems to compile with no issues.
What am I doing wrong? Does NetMulticast require parameters to be derived from UObject or something? Whats the best way to pass a chunk of data via a NetMulticast function?