Send class over network
I've managed to add some custom serialize methods in CustomTypes.cs
Basically what I want to create:
- When event occur I want to send byte array (serialized class) over the network
- Other player must deserialize it and render it properly
When someone shot others are notified so they can "fire" sound effect and render from the point.
I'm stuck I don't really know how to send this data over network. I cannot send this in every update method since this occurs only on specific events.
private static byte[] SerializeBullet(object customobject) public static object DeserializeBullet(byte[] bytes)
Basically what I want to create:
- When event occur I want to send byte array (serialized class) over the network
- Other player must deserialize it and render it properly
When someone shot others are notified so they can "fire" sound effect and render from the point.
I'm stuck I don't really know how to send this data over network. I cannot send this in every update method since this occurs only on specific events.
0
Comments
-
Sounds like you want to use RPCs then, which you can call when required and which allow you to send a byte[]
Just keep in mind that you can't send arbitarly large byte arrays. if you exceed the bandwidth you will at worst get dropped out0