Im trying to make a game in Unity with multiplayer and i’m using parrelsync to test it out but whenever I try to connect the players to the server it never works.
I always get this error message when i start up the clone
Im trying to make a game in Unity with multiplayer and i’m using parrelsync to test it out but whenever I try to connect the players to the server it never works.
I always get this error message when i start up the clone
Port 7777 is likely already in use by another application. Socket was still created, but expect erroneous behavior. This condition will become a failure starting in version 2.0 of Unity Transport.
UnityEngine.Debug:LogWarning (object)
Unity.Networking.Transport.BaselibNetworkInterface:Bind (Unity.Networking.Transport.NetworkInterfaceEndPoint) (at ./Library/PackageCache/com.unity.transport@1.4.1/Runtime/BaselibNetworkInterface.cs:660)
Unity.Networking.Transport.UnityTransportProtocol:Bind (Unity.Networking.Transport.INetworkInterface,Unity.Networking.Transport.NetworkInterfaceEndPoint&) (at ./Library/PackageCache/com.unity.transport@1.4.1/Runtime/UnityTransportProtocol.cs:19)
Unity.Networking.Transport.NetworkDriver:Bind (Unity.Networking.Transport.NetworkEndPoint) (at ./Library/PackageCache/com.unity.transport@1.4.1/Runtime/NetworkDriver.cs:1001)
Unity.Netcode.Transports.UTP.UnityTransport:ServerBindAndListen (Unity.Networking.Transport.NetworkEndPoint) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.9.1/Runtime/Transports/UTP/UnityTransport.cs:574)
Unity.Netcode.Transports.UTP.UnityTransport:StartServer () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.9.1/Runtime/Transports/UTP/UnityTransport.cs:1396)
Unity.Netcode.NetworkManager:StartHost () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.9.1/Runtime/Core/NetworkManager.cs:1059)
TitleScreenManager:StartNetworkAsHost () (at Assets/Scripts/TitleScreenManager.cs:10)
UnityEngine.EventSystems.EventSystem:Update () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:530)
And i get this error when trying to connect the clone to the host
[Netcode] Cannot start Client while an instance is already running
UnityEngine.Debug:LogWarning (object)
Unity.Netcode.NetworkLog:LogWarning (string) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.9.1/Runtime/Logging/NetworkLog.cs:28)
Unity.Netcode.NetworkManager:CanStart (Unity.Netcode.NetworkManager/StartType) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.9.1/Runtime/Core/NetworkManager.cs:917)
Unity.Netcode.NetworkManager:StartClient () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.9.1/Runtime/Core/NetworkManager.cs:1007)
PlayerUIManager:Update () (at Assets/Scripts/PlayerUIManager.cs:36)
Here is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class WorldSaveGameManager : MonoBehaviour
{
public static WorldSaveGameManager instance;
[SerializeField] int worldSceneIndex = 1;
private void Awake()
{
// THERE CAN ONLY BE ONE INSTANCE OF THIS SCRIPT AT ONE TIME, IF ANOTHER EXISTS, DESTROY IT
if (instance==null)
{
instance = this;
}
else
{
Destroy(gameObject);
}
}
private void Start()
{
DontDestroyOnLoad(gameObject);
}
public IEnumerator LoadNewGame()
{
AsyncOperation loadOperation = SceneManager.LoadSceneAsync(worldSceneIndex);
yield return null;
}
}
Hi, it seems that either the port you’re using is occupied by something else (could be any app with internet acess in your computer), or that you’re not shutting down the NetworkManager at the end of each session.
I’d recommend to have a look at the Small Scale Competitive Multiplayer template (available for Unity 2022.3, in the Unity hub, when you create a new project), specifically at the InitializeNetworkLogic
method of the CustomNetworkManagerClass
I think the problem is that the network manager isn’t properly getting shut down
Do u know I can fix that (I’m really knew to this stuff)
btw heres the tutorial im using if that helps