i am currently coding a game in unity with multiplayer. I set it up with a tutorial but only got errors.
This is the Video: Video
And this are the Errors
This is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Pun;
using UnityEngine.Realtime;
using UnityEngine.UI;
public class Manager : MonoBehaviourPunCallBacks
{
public InputField playername;
public Button playbutton;
void Start()
{
playbutton.interactable = true;
PhotonNetwork.ConnectUsingSettings();
PhotonNetwork.AutomaticallySyncScene = true;
}
void Update()
{
string playerNameText = playername.text;
PhotonNetwork.JoinRandomRoom();
}
public override void OnJoinRandomFailed(short returnCode, string message)
{
RoomOptions roomOps = new RoomOptions();
roomOps.IsVisible = true;
roomOps.IsOpen = true;
PhotonNetwork.NickName = playername.text;
string roomName = "Room" Random.Range(0, 1000);
PhotonNetwork.CreateRoom(roomName, roomOps);
}
public override void OnJoinRoom()
{
PhotonNetwork.LoadLevel(1);
}
}
Thanks for helping
CodePudding user response:
Change the namespaces:
using UnityEngine.Pun;
using UnityEngine.Realtime;
To this:
using Photon.Pun;
using Photon.Realtime;