Kochab
(Kochab)
1
I’m trying to add networking to my game, but when I try to make a function NetMulticast and Reliable like this:
UFUNCTION(NetMulticast, Reliable)
virtual void Dealing();
I get this error:
Error 1 error LNK2005: "public: virtual void __cdecl ASCard::Dealing(void)" (? Dealing@ASCard@@UEAAXXZ) already defined in SCard.cpp.obj C:\Users\Kochab\Documents\Unreal Projects\Spades\Intermediate\ProjectFiles\Spades.generated.cpp.obj Spades
What am I doing wrong?
Kochab
(Kochab)
2
.h
virtual void Dealing();
UFUNCTION(NetMulticast, Reliable)
virtual void ServerDealing();
.cpp
void ASCard::Dealing() {
if (Role == ROLE_Authority)
{
ServerDealing();
}
}
void ASCard::ServerDealing_Implementation() {
...
}
Note the addition of _Implementation
at the end of the function name. If that isn’t there it will throw the “already defined” error.
gstyczen
(gstyczen)
3
I love how it’s totally skipped in the documentation.
Can you spawn actors using multicast? So far it didn’t work for me, and I don’t want to make the spawned actors replicated.