Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Network issue

Discussion in 'Multiplayer' started by Fuzzylr, Sep 2, 2013.

  1. Fuzzylr

    Fuzzylr

    Joined:
    May 8, 2013
    Posts:
    18
    Greetings all,

    I am having an issue with Intelli-sense not working properly. I am just attempting to build something pretty small on the networking side of the things. This is a solo project just for the server. I should state I am fairly new to Unity

    The two items below do not show up when I type them out.
    Code (csharp):
    1.  Network.InitializeServer
    Code (csharp):
    1. Network.isServer
    Also I have the following error.
    $UnityError.png

    Here is the networking code
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Network : MonoBehaviour
    5. {
    6.     // Create network connection for server
    7.     private const string typeName = "DemoServer";
    8.     private const string gameName = "DemoNetwork";
    9.     //public string IP = "192.168.0.70";
    10.     public int Port = 3400;
    11.    
    12.     private void LaunchServer()
    13.     {
    14.         Network.InitializeServer(32, Port);
    15.         MasterServer.RegisterHost( typeName, gameName);
    16.         GUI.Label(new Rect(100, 125, 100, 25),"Connections: " + Network.connections.Length);
    17.     }
    18.    
    19.     void OnServerInitialized()
    20.     {
    21.         Debug.Log("Server Initialized");
    22.     }
    23.    
    24.     void onGUI()
    25.     {
    26.         // Starting the server
    27.         if(Network.isServer) { GUILayout.Label("Server");
    28.            
    29.         if(!Network.isServer)
    30.         {          
    31.             if(GUI.Button(new Rect(100, 100, 250, 100), "Start Server"))
    32.                 LaunchServer();
    33.         }
    34.     }
    35.    
    36. }
     
  2. Fuzzylr

    Fuzzylr

    Joined:
    May 8, 2013
    Posts:
    18
    I figured it out. It was kind of silly. It's because my script was the name as a pre-existing class. I renamed my class from Network to NetworkManager and poof everything came up.