- Home /
 
 
               Question by 
               noemin · Dec 17, 2013 at 04:23 PM · 
                gui.buttonnetwork.connect  
              
 
              Network.Connect() in code without button pressed
Is there a way to use Network.Connect() in code but without button attached to it ?
 if(GUILayout.Button("Join"))
 {
   Network.Connect(IP,25001);
 }
 
               I want to load a scene and on load connect automatically to a server but i dont want the player to press connect button in the scene in order to connect. Using Network.Connect() in code doesnt seem to work individualy is there another way?
               Comment
              
 
               
              Network.Connect is in no way dependent on OnGUI. You just need to have a server already running and know its IP. If you can't connect, there's something wrong with the server or your computer's network settings. 
Answer by Briksins · Dec 17, 2013 at 04:38 PM
just place it in the Start()
 Start()
 {
     Network.Connect(IP,25001);
 }
 
               it will connect it once at the start
Your answer