Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question I am having problems with setting up a multiplayer server

Discussion in 'Multiplayer' started by PanicMedia, Feb 8, 2021.

  1. PanicMedia

    PanicMedia

    Joined:
    Dec 6, 2020
    Posts:
    37
    I have been following this tutorial on youtube
    I've been able to setup a server (pretty much) thanks to the first episode and I've tried to follow the episode that I've linked and Visual studio has given me two of these errors:

    Error CS0246 The type or namespace name 'packet' could not be found (are you missing a using directive or an assembly reference?) EnforcerMultiplayerServer

    Error CS0103 The name 'ServerPackets' does not exist in the current context EnforcerMultiplayerServer

    Does anyone have any idea on how to fix these errors? I am going to post this in the programming section as well. Here's the scripts I used:
    Code (CSharp):
    1. using System;
    2. using System.Collections.Generic;
    3. using System.Text;
    4.  
    5. namespace EnforcerMultiplayerServer
    6. {
    7.     class ServerSend
    8.     {
    9.         public Packet packet;
    10.         public static void SendTCPData(int _toClient, Packet _packet)
    11.         {
    12.  
    13.         }
    14.         public static void Welcome(int _toClient, string _msg)
    15.         {
    16.             using(packet _packet = new packet((int)ServerPackets.welcome))
    17.             {
    18.                 _packet.Write(_msg);
    19.                 _packet.Write(_toClient);
    20.  
    21.                 sendTCPData(_toClient, _packet);
    22.             }
    23.         }
    24.     }
    25. }
    The packets script: https://github.com/tom-weiland/tcp-...utorial-part2/GameServer/GameServer/Packet.cs
     
  2. kas0610

    kas0610

    Joined:
    Nov 29, 2015
    Posts:
    7
    Hey there! You haven't made the ServerPackets class shown in the tutorial.