When I change the variable inventory ON THE SERVER the client doesn’t get the modifications. I don’t know if I did something wrong or if I need to create a RPC call from the server to the owning client to send the variable value.
I am going to guess that since your object UInventory starts with a U that you are inheriting from a UObject. If so, there is your problem. According to the UE4 docs, Actors replicate, but UObjects do not:
If you are using an Actor and not a UObject and it still does not work, make sure you are also properly marking the individual properties that you want to replicate with:
And of course make sure that you set bReplicates = true; in your constructor.
Thank you so much. I THINK my problem is solved… The only problem now is that I get these errors when compiling:
CompilerResultsLog:Error: Error C:\Users\GAME\ShooterGame\Source\ShooterGame\ShooterGameCharacter.cpp(84) : error C2275: 'AShooterGameCharacter': illegal use of this type as an expression
CompilerResultsLog:Error: Error C:\Users\GAME\ShooterGame\Source\ShooterGame\ShooterGameCharacter.cpp(84) : error C3861: 'DOREPLIFETIME': identifier not found
The errors are in my character class (which has the UInventory component) and refers to
void AShooterGameCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
//I guess I can't use AShooterGameCharacter as a type here...