InventoryStruct is a UProperty of the InventoryComponent. Each slot have as Outer the InventoryComponent.
The struct is perfect to organize and initialize all slots (each substruct have an init function). Is there any way to do this UObject replication with the slot ?
Also based on what I found on the web, nobody agrees on the best way to make an inventory replicated… Some people say to make AActor item/slot to replicate them, other say that replicate high number of AActor isn’t a good idea for the network performance… Our game is survival multiplayer (like Ark), there will be potentially a ton of item in their inventory, what way would be optimal to reduce network usage ?
Hello, I’ve tried to use approach you’ve mentioned but I faced a problem. For example I have Component and UObject* member inside:
UTestObject* testObject;
Inside UTestObject I just have a simple field like this:
UPROPERTY(Replicated)
int m_currentAmount = 0;
I also implemented both IsSupportedForNetworking and GetLifetimeReplicatedProps functions.
Then on both Server/Client in begin play I create testObject via NewObject. Then at somepoint of time I made an RPC call and change m_currentAmount on Server and I don’t receive this update on client.
However, if I change pointer itself, for example made something like this:
testObject = nullptr;
I will get an update on Client. Seems like it only replicates pointer by itself, but not the data inside pointer.
Do you know how to fix this? Thanks