It really does not give an error. It just does not compile, says failure and will not save the .dll Any time i try to add this to any function it will not compile UFUNCTION(Reliable, Server) or UPROPERTY(Replicated).
I read where we should use FPROPERTY() but that does not work, If i use either of those 2 settings i cant get it to compile. Take them out it compiles fine.
Very nice read. Nice to see it basically the same as udk :). I’m going after not using much blue prints. Do as much as i can in code :).
If i take the Reliable, Server OUT it will compile.
This function needs to be this way. i also have a few more functions i need to set the same way. When i do, same stuff happens as above. These few functions that i need (Reliable, Server) must be that or things will not work right.
UFUNCTION(reliable, server)//set this to a server function
void ServerShouldSprint(bool bSprint);
void ServerShouldSprint_Implementation(bool bSprint); //<--- You have this function too? This is described in Cedric's PDF.
The _Implementation method is the one that is actually defined in the .cpp
Hmmm…just thought of something.
You need to be sure the below include is setup. I put mine a header that is included in every cpp.
// This is NOT included by default in an empty project! It's required for replication and setting of the GetLifetimeReplicatedProps
the “Net/UnrealNetwork.h” just add it into your project.h file only. You do not need it in ever cpp files .h file.
Got everything from above added and it all compiles fine, until i add in Reliable, Server
Stumped at the moment, missing something somewhere.
Let’s pull this apart. The compiler doesn’t lie to you, so learning to read the errors will help you in the future.
FUUnrealCharacter.gen.cpp.obj : error LNK2005: "public: void __cdecl AFUUnrealCharacter::ServerIsSprinting(bool)" (?ServerIsSprinting@AFUUnrealCharacter@@QEAAX_N@Z) already defined in FUUnrealCharacter.cpp.obj
This means you have AFUUnrealCharacter::ServerIsSprinting defined twice, either in your .cpp or .h file. This can be a bad code gen if you’ve been marking it as a UFUNCTION and then removing it, so sometimes a rebuild will fix these issues - but often times it’s user error and the method is defined/implemented twice. If you’ve verified it’s not defined twice - then do a rebuild.
Unresolved external symbol means you defined something, but never implemented it. This can be a bit tricky with UE code as replicated methods require the following structure
// In MyCode.h
void MyServerMethod(int a, bool b);
// In MyCode.cpp
void MyServerMethod_Implementation(int a, bool b)
// Do stuff
So you DEFINE the method like normal, but the IMPLEMENTATION has to have the “_Implementation” moniker added to it. This is because the UE Header Tool will fill out the original “MyServerMethod” define with some boilerplate code and add a new version “MyServerMethod_Implementation” that the user is meant to override.
Also make sure your header file has the “MyHeaderFile.generated.h” included or you won’t actually get the generated code added to your own code.