Hi, I have a system for picking up and dropping items, in which I have a problem when I pick up the item after dropping it.
When I pick up the item from the floor for the first time (item that is already in the world) both the server and the client receive the information well and when dropping the item it also works well on both sides, but when I pick up the item that has was released, both run the event but only the server side receives the variable information in the event (Actor).
And as your pickup logic is, you shouldn’t spawn the item locally on a client like you’re doing inside the DropItemClient event. Cause in InteractServer/InteractClient you’re sending an actor reference between them and if you spawn an actor on a client, the server and all the other clients will never know about this and the reference will always be null there.
I do not think that it is otherwise the client or server would not be able to see the actor in the world, in any way I tried, in the actor that is dropped I selected replicates but with this active the actor does not spawn anywhere and still gives an error (Blueprint Runtime Error: “Attempted to access Int_Medkit_5 via property K2Node_DynamicCast_AsInterface_BP, but Int_Medkit_5 is pending kill”. Blueprint: Player Function: Run Ubergraph Player Graph: EventGraph Node: Interact)
If a non replicated actor is placed inside the level in the editor (so not spawned during the game), then you can send its reference through an RPC, if you spawn a non replicated actor during game then you can’t, it will always be null if you send it through an RPC. That is why your logic works for the first pickup but breaks once you try to pick the item up after you’ve put it down. What you’re sending through the RPC is not the actor itself but just a pointer to an existing actor.
If you want to spawn an actor and then be able to send its reference through an RPC, then you need to make that actor replicating and then only spawn it on the server. It will then automatically replicate to the clients (eventually).