I’m fairly new to Unity and I’m trying to get my first networking project started.
So far I’ve got my two players in scene, and I would like to get (share) opponents name. I tried to modify the health script from the Simple Example, but the best I could do was to get the Host name on the server.
I’ve been at this for about a week now. Reviewing the docs and searching the webs one more time is not working for me. I know this is a noob questing and maybe I’m not as apt as others, but could someone please point me to an example to do this? I really need some help here.
When you host a server, if you don’t already have a place to input your name, have a script that holds a string of the players name. Then use [SyncVar] to sync it to the client, and have it update into a text box or where ever you want it to display.
To get the client’s name to show up on server you will have to create a function that calls a command to the server. Will looks something like this.
Thank you so much for your reply. I’ve been going over the documentation, examples, and tutorials on this for almost two weeks now and the more I review the more I’m lost. I just don’t understand how all this works and modifying example to fit my needs hasn’t produced anything usable. I don’t understand your example either.
I have the player name in a public string and a small integer 2D array that I need to send before actual game starts. Your code assumes I know what is happening and that additional server / client code is involved. I don’t know what scripts to put on what objects and frankly I just can not wrap my head around how all this works. The Simple Network example helped to a point but the more I review examples and the more I tinker the more confused I’m getting. I’m hopelessly lost at this point and I don’t believe there is an example to help me understand as I’ve gone through all that I could find. I’m sure there are parts of examples that might help me, they are buried in code I do not understand and can’t see how to adapt that to my needs. I need something a lot more simple than the Simple Example. Where do I go?
To be honest I’m still learning UNet, its pretty easy once you get started. One day its like a lightbulb above your head and everything starts flowing and gets easy. Unfortunately I hit another roadblock with syncing lists.
But I pretty much did same thing as you though, read all the docs till I went crazy. They definitely could be a little better. It shows examples but never real world examples, or explains the details. I haven’t seen the simple example, but maybe this will get you started, this is a video version of the official one. Lots of people find him really good.
Hey thanks again. Well for me, the lightbulb is not even a dim glow right now. Instead of things getting clear after many rereads, they are more cloudy then ever. I have a bunch of disjointed bits in my head and can not seem to assemble them in any way that makes sense to me.
I’ve only been using Unity for several months now and have just completed my third game which was intended to have a two player option. I thought I could teach myself UNET the same as I am learning Unity. Maybe it’s too soon for me and multiplayer. As of this evening I’m giving up on this for now. I have wasted too much time on this with really nothing to show for it except a very bad taste in my mouth and an automatic dread of revisiting this topic.
Thanks for the link but Im done and can’t bring myself to waste more time going through another slew of videos just to get more confused and depressed over it.
UNET is a convoluted mess with very poor documentation and examples that do not fit real world game use. This forum is less than helpful also - a lot of question and very few answers, UNET shame on you. I admire those who have figured this out, and wish I had that same ability.
I have a complaint thread dedicated to this they released UNET/HLAPI/HostMigration/New Lobby schema but NEVER updated the docs for it and don’t have even 1 person trained for Q+A (even on Tickets or Unity Answers).
That’s because NO ONE KNOWS! The docs were never updated, they’re super conflicting and there’s not even any “proper/up-to-date” demos. Not one official video. The “new updated docs” on the sticky has 25 pages for post-game and 8 bullets for pre-game. I’m trying to raise awareness that it’s literally because the docs aren’t updated so maybe one day, the devs will actually update them and weed out the bugs instead of list the new feature and dump it forever!