I’m making a simple pickup item inventory for 2D multiplayer game but the actor overlap isn’t functioning properly. Can someone help me with it?
You can see the code here:
I’m making a simple pickup item inventory for 2D multiplayer game but the actor overlap isn’t functioning properly. Can someone help me with it?
You can see the code here:
Didn’t look into detail but I see a few potential problems right off the bat.
You are in PickupItemBase, and checking if the OTHER actor (= the actor who overlapped this item, ie. most likely the character) is a subclass of PickupItem. That sounds wrong.
Missing link here.
You are setting Controller when Controller is valid. You probably meant to set it when it is not.
WB_Main sounds like the name of a widget. Widgets do not exist on server, so this is not the right place to put that function in.
This code could easily be moved to the PC class. And modified a bit. Using GetPlayerCharacter(0) on server doesn’t make sense most of the time. Once you’ve moved this to PC blueprint you can use GetControlledPawn to get the proper player’s pawn.