Question by
MilitaryG · Aug 05, 2021 at 03:45 PM ·
c#multiplayer-networking
how to implement multiplayer in Unity 2020.3.15f1
if I make code:
using UnityEngine;
using System.Collections;
public class Client : MonoBehaviour {
public Transform Planet;
public string IP = "127.0.0.1";
public int Port = 25001;
void OnGUI (){
if (Network.peerType == NetworkPeerType.Disconnected){
if (GUILayout.Button("Start Client")){
Network.Connect(IP,Port);
}
}
else {
if (Network.peerType == NetworkPeerType.Client){
GUILayout.Label("Client");
if (GUILayout.Button("Change collor")){
GetComponent<NetworkView>().RPC("ChangeColor", RPCMode.All);
}
if (GUILayout.Button("Logout")){
Network.Disconnect(5);
}
}
}
}
[RPC]
void ChangeColor (){
Planet.transform.position.x = 500;
}
}
it says it isn't compatible in newer version and I must use Multiplayer but it says Multiplayer doesn't exist
Multiplayer mult;
also Network manager doesn't exist in components as it says in documentation do I really have to install non LTS unity?
Comment
Your answer
Follow this Question
Related Questions
Assigning Instantiated image to gameobject in script 2 Answers
Multyplayer nameplate not working 1 Answer
Unity Unet multiplayer wont sync rotation of a 2d object 0 Answers
UNET Host Can Aim Client Cannot 0 Answers
How to find local player gameobject? c# 3 Answers