Search Unity

GTGD's Unity Multiplayer Tutorials

Discussion in 'Community Learning & Teaching' started by GTGD, Feb 7, 2012.

?

Please select each option you agree with (you can select multiple options)

Poll closed Dec 22, 2015.
  1. I like that the videos are covering a complete project.

    230 vote(s)
    88.1%
  2. I find the videos are detailed enough for me to understand and follow.

    197 vote(s)
    75.5%
  3. I find the video quality is clear enough.

    186 vote(s)
    71.3%
  4. I find the audio quality is clear enough.

    180 vote(s)
    69.0%
  5. The narrator doesn't send me to sleep.

    143 vote(s)
    54.8%
  6. In general the topics covered are interesting.

    170 vote(s)
    65.1%
  7. I find the website useful.

    130 vote(s)
    49.8%
  8. The Gamer To Game Developer logo looks good.

    119 vote(s)
    45.6%
  9. I would like to suggest topics that GTGD should cover in the future.

    103 vote(s)
    39.5%
Multiple votes are allowed.
  1. scnoobi

    scnoobi

    Joined:
    Feb 26, 2013
    Posts:
    25
  2. newfinalflashers

    newfinalflashers

    Joined:
    Mar 1, 2014
    Posts:
    27
    Well I'm only 13 years old and of course I can't buy crafty off of the asset store because I don't have a credit card. So if you can show me a alternative or give me an idea to making or getting a patching system that would be great if not that's okay.

    Thanks.
     
  3. NikoBusiness

    NikoBusiness

    Joined:
    May 6, 2013
    Posts:
    289
    hey man i've checked the scripts and i am stuck i cant go further please give some i really need to go further its about 2 weeks that i am stuck :/
    this is my skype : maria.nizaraze , please add me so u help me solve my solution
     
  4. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    @scnoobi, a weapon with raycasting is the way to go when the projectile hits instantaneously. The blaster projectile is sort of doing that except it's firing the raycast from itself rather than from the camera or some other point. I should be covering weapons in a future series but not the upcoming series 2.

    @newfinalflashers, I don't have enough knowledge in that area to give you any decent advice unfortunately. If your game is small in size maybe you could ask your players to download the latest version of the game.

    @NikoBusiness, sorry for taking a while to get back to you. Do any error messages come up when you play as a server or as a client from the editor? Make a backup of your project and perhaps try replacing your scripts with mine one by one to isolate what the problem might be. I don't get in touch with Skype because I'm just not available most of the time, and also I might be obliged to offer that level of support to other viewers.

     
  5. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    Hello im,

    I've just implemented your code now and it's working awesome. Thank you! There's a small credit to you in the summary area of the new NetworkEstablishment script.

    GTGD S2 will be in a beta state and ready for everyone to test by Thursday. I haven't implemented sound in series 2 sorry, I'll do that in series 3 when I bring in weapons. I believe I really have completed the content for series 2 and I'll be working on designing the tutorials next and fixing any bugs people find.

    [video=youtube_share;d2DonXf9lKw]http://youtu.be/d2DonXf9lKw​

     
    Last edited: Mar 20, 2014
  6. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    On Sale GTGD S1: More Than a Gamer $1.99
    http://store.steampowered.com/app/269570/

    dont miss out the tutorials and the source code and the other stuff he gives you and the license to use it is well worth much more than that!

    i have S1 and its great and will be buying S2 today just to play with it and see what he did.
     
  7. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
  8. Razial7

    Razial7

    Joined:
    Oct 12, 2012
    Posts:
    59
    Thanks for the amazing tutorials. I have done quite a few Unity3d tutorials and have to say yours is perhaps the easiest to follow as you explain it all as you go. I am currently on vid 6 and everything works as it should except when i shoot another player, they do not take any damage. I have used different tags then you and a few scripts are named differently. I was as careful as I could be altering from your script as I went along but apparently I messed something up. If you have time to look over the project to see what is the matter I would appreciate it. If not perhaps you could guide me on possible reasons they wouldn't take damage.

    https://www.dropbox.com/sh/uhncr87hoyh0j79/2nNT0rrDei

    I noticed neither player ever registers as being hit in the check box of HealthAndDamage script.
     
    Last edited: Apr 6, 2014
  9. Grieve_physics

    Grieve_physics

    Joined:
    Oct 25, 2012
    Posts:
    26
    Purchased both GTGD1 2 once I found it on steam for an absolute bargain.

    Have noticed that GTGD1 the videos do not load from the application (Comes up with a red rectangle with a cross in it), Can find them in the directory as a workaround, but thought I should give you a 'heads up' on the issue.

    Thanks for you work on these
     
  10. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    I'm aware of the problem. Even with QuickTime installed some viewers are having a problem with video not loading up in the player. I'm currently hard at work building a new launcher for S1 that will be like the launcher for S2. I thought I'd be getting it out in May but I'm going to try and accelerate that to this week.

     
  11. Razial7

    Razial7

    Joined:
    Oct 12, 2012
    Posts:
    59
    Okay so I finally realized that I can kill the players but only the players on the same team can attack each other and kill. The opposite team cannot attack each other at all. So only blue can kill blue and only red can kill red....

    What do I have backwards in which script?

    Could you point me in a direction to search?

    Thanks



    ***Just found it. had my labels in the update of shooting script wrong.
     
    Last edited: Apr 8, 2014
  12. embero

    embero

    Joined:
    Jul 2, 2012
    Posts:
    5
    Is it possible to get / purchase the videos for Mac? Steam says it's Windows only :(
     
  13. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    I'm sorry it's a Windows only release. I haven't worked out yet how to do a Mac release and I suspect I need a Mac which I don't have. Series 2 is also very much a Windows thing.

     
  14. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    Good work, you've solved the problem on your own and that is a sure path to learning. I don't usually have enough time these days to help everyone with debugging but I've noticed that just about everyone finds a solution when they keep working away at it :).

     
  15. Styler_Gamedev

    Styler_Gamedev

    Joined:
    Mar 13, 2014
    Posts:
    3
    Hey, for some reason with the new GTGD S2 when I use the quick player set up, I lose almost all speed when I jump. I've tried messing around with the script and trying different models but had no luck. Changing air speed in the script didn't do anything, but when I watch your video all you have to do was put it on and you could jump forward. Any ideas? I've been messing with it a while and am missing it some how. Root motion is off because I plan for it to be multiplayer.

    On another note though, great work on S2! Thank you so much for putting the time and effort into it. I really appreciate the series and it has helped me learn so much! When my project is done I'll post it here for everyone to see :)
     
  16. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    I think I understand what is happening. Have a look at the inspector and you'll notice that you what you typed in the script doesn't appear in the Inspector for the Player Control script attached to the player. The speed and jumpVelocity variables are both public so you actually have to change them in the inspector or actively at run time.

     
  17. Styler_Gamedev

    Styler_Gamedev

    Joined:
    Mar 13, 2014
    Posts:
    3
    Still no luck it seems, thank you for the reply though :) I'm sure I'll figure it out soon, probably something silly I'm over looking like usual.
    I'll check back and also let you know if I figure it out.
     
  18. Styler_Gamedev

    Styler_Gamedev

    Joined:
    Mar 13, 2014
    Posts:
    3
    I tried commenting out the part of the code that slows you down if you hit an object mid air and I can move now, so it appears it's something attached to the character doing it, or the ground for some reason. Knowing this I should be able to fix it now, if I can't find what's causing it I can just up the value of required struck objects. So if anyone's having trouble jumping forward, try this :)

    Edit-

    So it turns out, the reason my camera was messing up (which I totally forgot to mention in the first post, but I think is related to this issue so I'm posting it anyway) is because the size of the capsule collider changing. I would zoom in ever time I jump, but disabling the size change has made it stop doing this. Just thought I would post if anyone else has had this issue.
     
    Last edited: Apr 19, 2014
  19. Vesttis

    Vesttis

    Joined:
    Apr 19, 2014
    Posts:
    1
    Having the error error CS1525: Unexpected symbol `Instantiate' .....my code looks exactly like yours but the error keeps coming up in the following:
    Code (csharp):
    1.  
    2.     // Use this for initialization
    3.     void Start ()
    4.     {
    5.         myTransform = transform;
    6.        
    7.         cameraHeadTransform = myTransform.FindChild("CameraHead");
    8.    
    9.     }
    10.    
    11.     // Update is called once per frame
    12.     void Update ()
    13.     {
    14.         if (Input.GetButton("FireWeapon"))
    15.         {
    16.             //the launch of the projectile will just be in front
    17.             //of the CameraHead
    18.    
    19.             launchPosition = cameraHeadTransform.TransformPoint(0, 0, 0.2f)
    20.            
    21.                
    22.             //Create the rocket projectile at the launchPosition and tilt its angle
    23.             //so that its horizontal using the angle eulerAngles.x plus 90
    24.            
    25.             Instantiate(rocket,launchPosition,Quaternion.Euler(cameraHeadTransform.eulerAngles.x + 90,
    26.                                                                myTransform.eulerAngles.y, 0));
    27.         }
    28.     }
    29. }
    as you can see ive changed the name from blaster to rocket for future reference.
    THE ERROR Is ON THE LINE STARTING WITH INSTANTIATE.
     
    Last edited: Apr 19, 2014
  20. HarrisonGPink

    HarrisonGPink

    Joined:
    Apr 4, 2014
    Posts:
    45
    Vesttis: It's actually nothing to do with line 24. It's because on line 18 you didn't end the line with a semicolon. I do this all the time. :p
     
  21. bromber

    bromber

    Joined:
    Dec 20, 2013
    Posts:
    5
    Want to thank you for the videos, it's given me a new spark to get back into programing as the last time I did any programing was 15 yrs ago. I used 'c' and 'c++', a lot has changed in the way things are programed now and was worried about getting my hands dirty with all the new languages out there but the way you explain in the videos I cant see any problems transferring my knowledge in to 'c#' it looks quite similar to 'c++'.

    I have bought both sets of your videos and will keep buying any you put out, your done a wonderful service to the community by producing these videos, I know the time and effort you must of put into these must of been hard and frustrating at times. I hope you can make some thing back on the low prices of these videos.

    Would be nice to see if any people in here has got together to collaborate on any projects. So any feed back from the community about projects you are working on would be nice to hear about, and it would give GTGD a moral boost.
     
  22. SVGK

    SVGK

    Joined:
    Jan 25, 2014
    Posts:
    99
    Hmm, you mention a certain way to use S2, I'm guessing that I'm meant to buy series 2, and do S1, using some videos from S2 to fix the issues with recent unity versions?.

    EDIT: Never mind, just noticed that the conversion video is on the youtube channel for free.
     
    Last edited: Apr 20, 2014
  23. S3dition

    S3dition

    Joined:
    Jan 6, 2013
    Posts:
    252
    I enjoy the series, but if I might make a suggestion:

    There are metric dump truck loads of tutorials that show you how to "make call of duty so you can get rich and make everyone love you!"... okay, maybe not that last part. Still, I'd say the majority of tutorials focus on FPS gameplay. And while there are a lot of people who watch them, there are still people interested in multiplayer RTS, RPG, Card, Civ, and other types of games. Even turn based. Approaching these genres might help add a bit of variety to both the tutorials and games that are produced. And in my humble opinion, there is nothing wrong with variety. Plus it may answer other questions that people may have, such as how to select and manipulate objects using ray cast (critical for RPG, RTS, and connect three games).

    Just a thought. Tutorials are always a good thing :)
     
  24. HarrisonGPink

    HarrisonGPink

    Joined:
    Apr 4, 2014
    Posts:
    45
    Hi GTGD, thanks for the fantastic videos.

    I had a question (not a problem) about a thought you raised at about the 30 minute mark of Video 11 of Season 1. You mentioned that if you wanted to be more efficient, you wouldn't send the position or scale data in the RPC when simply updating the player's rotation. How would you actually go about this? Is it possible to just leave that data out of the RPC? It seems like you have to send all three arguments in each RPC. Would you instead create three separate RPCs with one argument each?

    Just curious as I am too new to programming to know what is possible but I do appreciate understanding how to be more efficient when learning.

    Thanks again!
     
  25. HarrisonGPink

    HarrisonGPink

    Joined:
    Apr 4, 2014
    Posts:
    45
    Okay GTGD I actually have a real problem I could use some help with now.

    I just finished your Blink video (12) and the script is not properly turning off the player's graphics or trigger during the teleport. I even commented out the lines in the coroutine that are supposed to re-enable them to make sure it wasn't that it was happening too fast for me to see. Even with the re-enable code commented out, the playerGraphics are not being disabled and the trigger is not being disabled.

    Any help would be greatly appreciated! I'm running Unity 4.x
     
  26. Entire

    Entire

    Joined:
    Apr 2, 2014
    Posts:
    1
    Hi GTGD Look when i setup a server then player join it then nothing happens it gives me shutdown server i want to start a multiplayer map that i did i made a map called Map1 and i want it to load that and make it multiplayer so people join it But How ? Plzz Plz Plz Reply I Hope you explain with simple words so i can understand
     
  27. Grimwall

    Grimwall

    Joined:
    Apr 26, 2014
    Posts:
    2
    Script Problems

    I don't know what I'm doing wrong or what it is thats messing up, in EP3 of making your projectile I've did the blasterscript exactly
    as presented, but yet I'm getting error CS1519 with an unexpected symbol, I've tried fixing it and idk whats the problem it's exactly as described in the video.



    Help would be greatly appreciated.
     
  28. Grieve_physics

    Grieve_physics

    Joined:
    Oct 25, 2012
    Posts:
    26
    Been working through the S1 tutorials and learning as I go.. Awesome stuff.

    However just realised a minor problem that I am using Shruiken Particle system. instead of the legacy particle system.

    Video: S1-3
    Problem: When the explosion particle system is instantiated it remains in the hierarchy. The system is not looped, so you can not see the particle system going.
    Attempted Resolution: creating a similar coroutine used for the blaster timed destroy but am left with the following error:
    This makes me think I might have missed something.
    Has anybody else managed to resolve the issue?

    Included the code on Pastebin for Formatting.

    http://pastebin.com/gGEgpTGy
     
  29. Grieve_physics

    Grieve_physics

    Joined:
    Oct 25, 2012
    Posts:
    26
    @Grimwall. On first glance your issue seems to lie in your raycast section.

    You should have it in correct brackets, and check that every bracket has a matching pair. You also had a space in the word myTransform. Here is the corrected version:

    Hopefully this helps you out
     
  30. childhood

    childhood

    Joined:
    Apr 4, 2014
    Posts:
    3
    hi

    sorry about this question, but before I go into your tutorials I wanted to know is this the same way that we do multiplayer games for iphone and android devices! can we export such mechanism to such devices!

    i'm talking for games such as fun run, chess, card games, 3rd person death matches, worms...etc!

    sorry but i'm really looking for an amazing tutorial like in which shows how we can create such mechanism without bugs.
     
  31. Tiggster

    Tiggster

    Joined:
    May 22, 2013
    Posts:
    29
    I've gone through series 1 and its absolutely awesome! I just picked up the second series on Steam and can't wait to get started. Thanks for such a wonderful learning tool.
     
  32. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    hi im having problems with s2 running on unity 4.5.0

    animations are not playing at all and the robot's body sinks half way into ground. :(

    anyone figured out what unity change in unity 4.5 may have broken this asset?
     
  33. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    ok i was able to fix the issue

    basically find the Spawn Point game object and change Y in from 0.25 to 1 and kyle's body will no longer sync halfway into the ground and the animations will play just fine...

    also dont forget to change the prefab for Spawn Point as well!

    so its just some little change in unity that uncovered the bug...
     
    Last edited: Jun 2, 2014
  34. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    ok ran into another little problem

    cannot setup a private server it prompts for name and port i press button to start the server and it goes back to main menu without starting the private server :(

    so i bet code has small bug cause of some other change in unity 4.5...

    ouch. can hardly wait for unity 5 that should be fun porting existing stuff to ;)
     
  35. unicorn_lova

    unicorn_lova

    Joined:
    Jul 9, 2014
    Posts:
    3
    My friend told me about your Vids and i thought the idea was great, i bought S1 and S2 on Steam to support you. I have made one project with S1 and I wanted to make another one. on my first project i downloaded most of the script from the site and I really didn't learn much... so I was one S1 vid 2 and you where coding the camera script, the on with the empty game object called camera head(i named mine FPS CAMERA) and fore some reason when i make it play mode it gives me an error about line 35 when it is just like yours! please help. i have uploaded the code and error. error.jpg
     
  36. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    The script will be looking for the CameraHead so since it can't find it an error is thrown up. You need to use the same name as me with same spelling and case. If you change the name of a GameObject then you must also change what the script is trying to find as well.

     
  37. unicorn_lova

    unicorn_lova

    Joined:
    Jul 9, 2014
    Posts:
    3
    If you look at the picture attached in the original post
    you will see that in the code i have changed all of the code where "cameraHead" is to "FPSCAMERA" so i don't know why your suggestion would do anything....


    I did what you said and know my code and game objects are EXACTLY like the ones in the video upload_2014-7-10_18-9-12.png

    but as you see i am still getting the error on line 35

    upload_2014-7-10_18-10-32.png

    if you cant read it it says
    "
    NullReferenceException
    UnityEngine.Transform.get_position () (at C:/BuildAgent/work/842f9557127e852/Runtime/ExportGenerated/Editor/UnityEngineTransform.cs:19)
    CameraScript.Update () (at Assets/Scripts/CameraScript.cs:35)"

    Please help, i don't want to "Cheat" and just download your scripts, i want to learn for my self to beter my education!
     
  38. unicorn_lova

    unicorn_lova

    Joined:
    Jul 9, 2014
    Posts:
    3
    Never mind I am simply an idiot, i was adding the script to the CameraHead and not the player... sorry for wasting your time.
     
  39. zweg25

    zweg25

    Joined:
    Nov 2, 2013
    Posts:
    5
    @GTGD you do fantastic work!!
    I love your tutorials! I went through the first 8 in a week... But I need your help.

    As I said I worked on the first 8 tutorials on a windows computer, but when I went home and put it on my Mac and tried to open the project, it crashes unity. I have restarted, and reinstalled everything, but every time I open the project, unity crashes.

    Do you have any ideas why this is happening? This does not happen with any other project.

    Thanks
    zweg25
     
  40. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    I've never used a Mac so I'm not familiar with what might be happening. Does the editor crash when you try to open other projects like Angry Bots or Bootcamp?

     
  41. zweg25

    zweg25

    Joined:
    Nov 2, 2013
    Posts:
    5

    No, only when I open the series 1 project. Is there anything I can do to save the time of restarting all the videos?

    Thanks
    zweg25
     
  42. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    If you have the Steam version then you could try opening a project folder for any video and see what happens. Apart from that I really don't know sorry.


     
  43. zweg25

    zweg25

    Joined:
    Nov 2, 2013
    Posts:
    5
    Very weird problem, but I figured it out. I tried opening the file in an older version of unity, and it worked enough to give me what the error was. My metadata folder became corrupt, which was crashing unity.

    So I deleted the metadata folder and it worked, it got rid of a few things, but nothing that should take me over 20 minutes to put back together.

    Sorry for the weird problem
     
  44. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    Good to see that you got it all sorted out.

     
  45. FoxHound13

    FoxHound13

    Joined:
    Aug 1, 2014
    Posts:
    2
    At the moment, I'm watching the 4th video of the series, where you teach create a multiplayer system, I'm in 46:11 minutes, my script has no errors, but when I go to test my project, the window to create the server does not appears, what is happening? I use version 4.5 of unity.

    PS: My script it's in Portuguese.
    PS²: My script is not ready yet :p

    idk.png


    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class MultiplayerScript : MonoBehaviour {
    6.     //INICIO DAS VARIAVEIS________________
    7.  
    8.     private string titleMessage = "Prototipo de Jogo 1";
    9.  
    10.     private string connectToIp = "127.0.0.1";
    11.  
    12.     private int connectionPort = 26500;
    13.  
    14.     private bool useNAT = false;
    15.  
    16.     private string ipAddress;
    17.  
    18.     private string port;
    19.  
    20.     private int numberOfPlayers = 10;
    21.  
    22.     public string playerName;
    23.  
    24.     public string serverName;
    25.  
    26.     public string serverNameForClient;
    27.  
    28.     private bool iWantToSetupAServer = false;
    29.  
    30.     private bool iWantToConnectToAServer = false;
    31.  
    32.  
    33.  
    34.  
    35.  
    36.     private Rect connectionWindowRect;
    37.  
    38.     private int connectionWindowWidth = 400;
    39.  
    40.     private int connectionWindowHeight = 280;
    41.  
    42.     private int buttonHeight = 60;
    43.  
    44.     private int leftIndent;
    45.  
    46.     private int topIndent;
    47.  
    48.  
    49.  
    50.  
    51.     // Use this for initialization
    52.     void Start ()
    53.     {
    54.         serverName = PlayerPrefs.GetString("NomedoServer");
    55.  
    56.         if (serverName == "")
    57.         {
    58.             serverName = "Servidor";
    59.         }
    60.  
    61.  
    62.     }
    63.  
    64.     // Update is called once per frame
    65.     void Update () {
    66.  
    67.  
    68.     }
    69.  
    70.  
    71.     void ConnectWindow(int windowID)
    72.     {
    73.  
    74.         GUILayout.Space(15);
    75.      
    76.      
    77.         //Quando o player abrir o jogo,ele tera a
    78.         //opçao de criar um servidor ou se juntar a um servidor.
    79.         //As variaveis IWantToSetupAServer e IWantToConnectToAServer
    80.         //inicia como falso,entao o jogador tera dois botoes
    81.         //"Iniciar meu server" e "Conectar a um servidor"
    82.  
    83.         if(iWantToSetupAServer == false && iWantToConnectToAServer == false)
    84.         {
    85.             if(GUILayout.Button("Iniciar um servidor", GUILayout.Height(buttonHeight)))
    86.             {
    87.                 iWantToSetupAServer = true;
    88.             }
    89.  
    90.             GUILayout.Space(10);
    91.  
    92.             if(GUILayout.Button("Conectar a um servidor", GUILayout.Height(buttonHeight)))
    93.             {
    94.                 iWantToConnectToAServer = true;
    95.             }
    96.  
    97.             GUILayout.Space(10);
    98.  
    99.             if(Application.isWebPlayer == false && Application.isEditor == false)
    100.             {
    101.                 if(GUILayout.Button("Sair do Prototipo", GUILayout.Height(buttonHeight)))
    102.                 {
    103.                     Application.Quit();
    104.                 }
    105.             }
    106.      
    107.         }
    108.  
    109.  
    110.         if (iWantToSetupAServer == true)
    111.         {
    112.      
    113.             GUILayout.Label("Digite um nome para seu servidor");
    114.  
    115.             serverName = GUILayout.TextField(serverName);
    116.  
    117.             GUILayout.Space(5);
    118.  
    119.  
    120.             //O player pode digitar a porta do servidor
    121.             //no campo de texto.Foi definido como padrao
    122.             //a porta de numero 26500.
    123.  
    124.  
    125.  
    126.             GUILayout.Label ("Porta do servidor");
    127.  
    128.             connectionPort = int.Parse(GUILayout.TextField(connectionPort.ToString()));
    129.      
    130.             GUILayout.Space(10);
    131.  
    132.             if(GUILayout.Button("Iniciar meu servidor", GUILayout.Height(30)))
    133.             {
    134.                 //Cria o servidor
    135.  
    136.                 Network.InitializeServer(numberOfPlayers, connectionPort, false);
    137.  
    138.                 //Salvar o nome do servidor usando PlayerPrefs
    139.  
    140.                 PlayerPrefs.SetString("NomedoServer", serverName);
    141.  
    142.                 iWantToSetupAServer = false;
    143.             }
    144.  
    145.             if(GUILayout.Button("Voltar", GUILayout.Height(30)))
    146.             {
    147.                 iWantToSetupAServer = false;
    148.             }
    149.         }
    150.  
    151.  
    152.  
    153.  
    154.  
    155.     }
    156.  
    157.  
    158.  
    159.     void OnGui()
    160.     {
    161.         //Se o jogador se desconectar,entao vai rodar a funcao ConnectWindow
    162.  
    163.     if (Network.peerType == NetworkPeerType.Disconnected)
    164.         {
    165.           //Determina a posicao da janela baseado na altura e na largura da tela.
    166.        
    167.  
    168.             leftIndent = Screen.width / 2 - connectionWindowWidth / 2;
    169.  
    170.             topIndent = Screen.height / 2 - connectionWindowHeight / 2;
    171.  
    172.             connectionWindowRect = new Rect(leftIndent, topIndent, connectionWindowWidth, connectionWindowHeight);
    173.  
    174.             connectionWindowRect = GUILayout.Window(0, connectionWindowRect, ConnectWindow, titleMessage);
    175.  
    176.  
    177.         }
    178.     }
    179.  
    180.  
    181.  
    182.  
    183.  
    184. }
    185.  
    186.  
     
  46. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    You are using the wrong case for OnGUI, you've written it as OnGui. Be very careful with case and make sure to use the same as me because inbuilt Unity functions won't be called unless their names are written correctly.

     
    FoxHound13 likes this.
  47. FoxHound13

    FoxHound13

    Joined:
    Aug 1, 2014
    Posts:
    2
    *-* thank you so much GTGD,i'm loving your tutorials,greetings from Brazil =)
     
  48. what

    what

    Joined:
    Nov 19, 2013
    Posts:
    1
    GTGD. Thank you.

    I have two questions.

    1. How would I go about optimizing if I want to create a separate version of the game that runs in (batch mode nographics) as server. And another as Client. You see I want to be able to run the server version on my computer without any UI popping up or sounds playing on my system.

    2. Would you please make additional video(s) for adding support mobile touch based platforms?

    EDIT: In light of Unity 5 beta being released and some of the scripts needing to be updated, is there a chance to see an update to U5 video?

    Perhaps an entire new series with brand new UI tools and everything?
    cheers
     
    Last edited: Aug 26, 2014
  49. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    I'm really sorry for taking forever to get back to you.

    1. Yes you could do that if you create some custom code where the server is automatically setup. So everything the user currently has to do to setup a server is just automated, and that is certainly doable. I don't think you can totally remove rendering because if you have a GUI it will continue to render ontop of itself even with a disabled camera, or no camera. I'd suggest changing the culling mask to nothing so that the camera doesn't see anything in the scene. Disable the audio listener on the camera for no sound. Player movements, instantiations and all that will continue to happen on the server. I think basically what you'll end up doing is making your own system in the editor so that when you change some setting (flicking a switch) the build type will be a server or it will be a game, and you'll then build two different versions of your project. One a server, and the other for the players.

    2. Maybe in the future when I have enough experience and knowledge to explain how to develop a game for mobile. My current methodology is not efficient enough for serious mobile development.

    I'm thinking that when Unity 5 comes out I should start work on a new tutorial series covering the new tools. Unity is developing a new multiplayer system as well! I'll leave Series 1 and 2 as they are. I'm currently developing a game and I'm targeting a release for the end of the year. So if all goes well my intention is to look into making tutorials next year.


     
  50. Stoakes

    Stoakes

    Joined:
    Sep 15, 2014
    Posts:
    4
    Hi, to begin with, thank you for this serie, it's really the best tutorials on Unity I've ever saw.

    However, I'm coping with an akward bug.

    I set the terrain and the water this morning.
    However I discovered that if I walk at the max speed to the top of a hill, shoot to my feets or bump into something, I suddenly begin an out of control flight (linear-rectilign ascending movement). It reacts as if gravity didn't exists. I tried several times, with different saves of the project, it always happens.

    Thanks for your reply.
     
    Last edited: Oct 5, 2014