Jump to content

How to share a prefab with client (inventory component)?


Recommended Posts

In my prefab i have a onPickup function 

if owner.components ~= nil and owner.components.inventory ~= nil then
		owner.components.inventory:SetCasket(inst)	
	end

The SetCasket function is added to the inventory component, the replica and the classified. but how can i trigger a change (on pickup) to the client? This will work fine for the host but the client didn't get this information.

This function from the inventory should somehow update the inventory_replica, too

local function SetCasket(self, casket)
	self.casket = casket	
end

Any ideas would be great, thanks!

Link to comment
Share on other sites

I think net_entity should work for you. Just listen for whenever it is set, but I don't think the instance will be valid unless the client has an active instance of it as well. I'm guessing that shouldn't be a problem for your case though.

Edited by penguin0616
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...