Sending a custom class

Options
kriller509
edited March 2019 in Photon Bolt
So I want to save the player's inventory but as far as I'm aware Photon Bolt only supports basic types (int, bool, etc.) but the class I have (InventoryData.cs) looks like:

-integer of max slots
-An array of InventorySlot.cs (another custom class)

Among other things, so lots of custom classes around which to my knowledge cannot be sent over the network. Any thoughts?

My goal here is to have send the data of the inventory over the network when the player leaves (save it), and then have the server send it to the player when they rejoin (load).

Comments

  • DirtyHippy
    Options
    In most cases you can break stuff like inventory down in an array of Bolt objects. If not you can use IProtocolTokens. You can either make an array of IProtocolTokens in your state (and use state for your inventory), or if you want to use events you can send protocol tokens as well. Protocol tokens are just generic stream read/writers.