lidgren / lidgren-network-gen3

Lidgren Network Library
https://groups.google.com/forum/#!forum/lidgren-network-gen3
MIT License
1.19k stars 331 forks source link

Added serialize functions for common Unity types. #65

Closed fversnel closed 8 years ago

fversnel commented 8 years ago

For everyone who uses Lidgren with Unity this might be useful. You can now simply write your Vector3, Quaternion etc. directly to the Lidgren Netbuffer by calling (for example):

NetBuffer.Write(new Vector3(1.0f, 1.0f, 1.0f));

fversnel commented 8 years ago

How about creating a new project called Lidgren.Unity project in the same solution and put all Unity related code in there? Since this is only one file it doesn't really matter but if we get more Unity specific code this might be a better approach than to add all files directly to the main Lidgren project.

lidgren commented 8 years ago

Hi! Thanks for the code; I changed it slightly since the NetBuffer is already a partial class, it makes sense to just incorporate them there. Let's add a special project when we get enough files to warrant it.

fversnel commented 8 years ago

Cool! Thanks for accepting :)

lidgren commented 8 years ago

Thanks again for the code... I don't use Unity so it's all untested (even uncompiled!) from my side; please sync and verify I didn't leave any compile errors in there...