Unity Networking Tutorial in C# – Part 1

Page moved to PalladiumGames.net

 

 

 

 

Page moved to PalladiumGames.net

Comments

  • voxel (@voxel)  On October 29, 2011 at 5:23 pm

    This is the most sane, clearly written unity networking tutorial I’ve come across. Thanks very much 🙂

  • Gordon Jennings  On November 8, 2011 at 9:01 am

    Hi, I’m not sure what I’m doing wrong, but I’ve got the authoritative version built and the only slight differences are that I have a singleton-like object that is used for checking input (i like to keep input checking modular and separate instead of having scattered input checks throughout my code). I’ve also had to add the network view to the prefab via code in it’s Awake because unity won’t let me drag via the inspector for some reason. (I actually prefer the code to dragging, less the artists can screw up).

    These two adjustments should not effect any of the network code.

    Anyway, only the server player can move. I’ve tried various combinations of using the editor, built exes, and browser builds just in case there was some sort of network and/or input confusion with the programs running on the same machine.

    I’d like to send you my project so you may look at it. It’s likely just a slight typo, I’ve followed your tutorial(s) from top to bottom of this page. The first couple worked out fine, but then the last 2 I was only able to move the server player.

    Here is a link to download my project:
    http://www.gordonjennings.net/temp/test.zip

    Between 8am and 4:30pm (GMT-4) you can contact me at: gordon.jennings@armyelearning.ca

    Outside of those hours you can contact me at: gordon@gordonjennings.net

    You’re help is much appreciated.

    • imtriggerhappy9  On December 14, 2011 at 12:52 am

      I think you need to finish them up… just keep going throught the tutorials. The last script is what you are looking for.

  • imtriggerhappy9  On November 28, 2011 at 4:00 pm

    i completely agree with the first comment thank you very much!

  • Ben  On January 26, 2012 at 7:21 am

    This was really useful in learning unity networking with C#, Thank you very much 😀

  • Valrak  On February 4, 2012 at 11:20 am

    This was really helpful, thank you, but I can’t seem to find part 2 (the link on the post only leads to part 1), any help?

  • Darren  On February 23, 2012 at 6:05 am

    This is great, however, where is part 2, as i was hoping to see this as a fps (as thats where im having problems) Thanks again though, good article

  • John Chalmers  On October 27, 2012 at 10:02 pm

    Sorry my brain is so slow but how would you send rotation details over the network can someone show me ?

  • irwin  On November 3, 2012 at 2:09 am

    Hmm… I can’t seems to use any function like Network.InitializeServer(…) in C# Script. Is it because I’m developing an iOS app, using Unity iOS Basic? Or is there some mistake I’m doing? I can use the Network classes in Javascript though…

  • irwin  On November 3, 2012 at 4:42 am

    ignore the previous post, it was just some silly mistake I made, it works fine now

  • John Chalmers  On November 24, 2012 at 7:02 pm

    This is probably the best networking tutorial on Unity3D C#, can you finish it with Masterservers and NATpunchthrough?

  • Oru  On December 29, 2012 at 8:32 pm

    Great Tutorial! Easy to understand and follow!
    I’ve got some questions:

    1.Right now, the code doesn’t include a way to destroy a player’s cube when he disconnects. I think I should use the function OnPlayerDisconnect() to trigger the removal of his cube but I’m not sure where to put the “Destroy Cube” function. Should this function be an [RPC]?

    2. If I’m a client and I disconnect and reconnect to the server, the number of cubes that instantiates under my control keep increasing everytime. E.g: 3 cubes instantiate at once of my 2nd connect. Why is that and how can I fix it?

    I’m looking forward to the 2nd part of this tutorial 😀

  • neologiac  On January 9, 2013 at 5:36 am

    thanks a lot, was really helpful.

  • abreu20011  On January 27, 2013 at 10:02 am

    Thanks!!! Very, very thanks. A clear and nice tutorial about networking 🙂

Leave a comment