Trying to use Photon Pun for Multiplayer

Hi, I've been trying to add multiplayer to my game using Photon Pun, and I am currently trying to make the player join the room when they press join. I have
public void OnClick() {
Launcher.Instance.JoinRoom(info.name);
}

but an error pops out saying cannot convert from 'string' to 'Photon.Realtime.RoomInfo'
Here is my full code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Realtime;
using Photon.Pun;
using TMPro;

public class RoomListItem : MonoBehaviour
{
    [SerializeField] TMP_Text text;

    RoomInfo info;

    public void SetUp(RoomInfo _info) {
        text.text = _info.name;
    }

    public void OnClick() {
        Launcher.Instance.JoinRoom(info.name);
    }
}

As the error says you want to pass in the full info and not just the name of the info. Launcher.Instance.JoinRoom(info);

1 Like