Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-1
Question by trallaton · Feb 24, 2014 at 12:29 AM · multiplayerserver

I have this script here for multi player and I cant seem to find the compiler errors.

This is the script im using.

   using UnityEngine;

using System.Collections;

/// /// Multiplayerscript. This script is attached to the MultiplayerManager and it /// is the foundation to our multiplayer system. ///

public class Multiplayerscript : MonoBehaviour {

 //variables start___________________________________

 private string TitleMessage = "GTGD Series 1 Prototype";


 private string ConnectToIP = "127.0.0.1";

 private int connectionPort = 26500;

 private bool useNAT = false; 

 private string ipAdress;

 private string port

 private int numberOfPlayers = 10:

 public string playerName;

 public string severName;

 public string serverNameForClient;

 private bool iWantToSetupAServer = false;

 private bool iWantToConnectToASever = false;


 //these variables are use to define the main
 //window.

 private Rect connectionWindowRect;

 private int connectionWindowWidth = 400;

 private int connectionWindowHeight = 280;

 private int buttonHeight = 60;

 private int leftIndent;

 private int topIndent;




 // Use this for initialization
 void Start () {
 
 }
 
 // Update is called once per frame
 void Update () {


 void connectWindow()int winowID
 (
     //Leave a gap from the header.
         GUILayout.Space(15);

     //When the player launches the game they have the option
     //to create a server or join a server. The variables
     //iWantToSetupAServer and iWantToConnectToAServer start as
     //false so the player is presented with two buttons 
     //"Set up my server" and "connect to a server"

     if(iWantToSetupAServer == false && iWantToConnectToASever == false)
     {
         if(GUILayout.Button("Set up a server", GUILayout.Height(buttonHeight)))
         {
                 iWantToSetupAServer = true;
         }

         GUILayout.Space(10);

         if(GUILayout.Button("connect To a server", GUILayout.Height(buttonHeight)))
         {
             iWantToConnectToASever = true;
         }
         GUILayout.Space(10);
         if(Application.isWebPalyer == false && Application.isEditor == false
         
             if(GUILayout.Button("Exit Prototype", GUILayout.Height(buttonHeight)))
             {
                 Apllication.Quit(); 
             }
         }

}

 void onGUI()        
 {
     //If the player is disconnected then run the ConnectWindow function
     if (Network.peerType == NetworkPeerType.Disconnected) 
     {    
         //Determine the position of the window based on the width and 
         //height of the screen. The window will be placed in the middle
         //middle of the screen

         leftIndent = Screen.width / 2 - connectionWindowWidth /2;

         topIndent = Screen.height / 2 - connectionWindowHeight /2
         
         connectionWindowRect = new Rect (leftIndent, topIndent,connectionWindowWidth,
                                          ConnectionWindowHeight);
         connectionWindowRect = GUILayout.Window(0, connectionWindowRect, ConnectWindow,
                                                 TitleMessage);
         
     }
 }








 
 }

}

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image trallaton · Feb 24, 2014 at 12:29 AM 0
Share

Any help would be very much appreciated! :)

avatar image Linus · Feb 24, 2014 at 12:30 AM 0
Share

not read carefully but, void onGUI() should be OnGUI big O

avatar image trallaton · Feb 24, 2014 at 12:54 AM 0
Share

Okay ill fix that thank you

avatar image trallaton · Feb 24, 2014 at 01:21 AM 0
Share

Yeah I wrote this but I was following this video.

   http://www.youtube.com/watch?v=quxZ3DCtjuI&list=PLC90282759FD90F77


Their is 6 errors in this and they are: (16,15) parsing error, (12,16) name space, (10,14) name space, (8,13), (6,16) name space, (3,16) namespace.

avatar image trallaton · Feb 24, 2014 at 01:22 AM 0
Share

The console doesn't say anything about line 56 being an error

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by robertbu · Feb 24, 2014 at 01:04 AM

Did you write this script? There is not just a single error here, but a number of them. To fix the errors, double click on the top error in the list in Unity and then go to Monodevelop. The error will be on the line it highlights or sometimes the line before. Fix that one error and then go back to Unity and get the new top error.

The first couple are simple errors, but you also have a larger messes on line 56. You are attempting to nest the 'connectWindow() function inside of Update() and have what I think is a variable declaration outside the body of the funciton. You cannot nest functions in C#

You need to go back and look at the structure of this code. Consider commenting out the contents of functions and then do what is necessary to get all the empty functions to compile. Then go back and worry about the contents.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

I need Help with Multiplayer I can server but not use client 3 Answers

Unity networking tutorial? 6 Answers

setup a php master server 2 Answers

cloned game object wont call script right... 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges