简体   繁体   中英

ERROR message. Type or namespace definition, or end-of-file expected

Help me. I am attempting to build a multiplayer game in in unity using photon cloud. i am using the free asset store extension to connect to the server. however, no matter what i do, this error shows:

Type or namespace definition, or end-of-file expected

I neither understand what it means nor know what to do about it. can someone help me, please?

my code is this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using UnityEngine.SceneManagement;

public class LoadServer : MonoBehaviourPunCallbacks
{
    
    private void Start()
    {
        PhotonNetwork.ConnectUsingSettings();
    }

    
    public override void OnConnectedToMaster()
    {
        PhotonNetwork.JoinLobby();
    }

    public override void OnJoinedLobby();
    {
        SceneManager.LoadScene("Lobby");
    }
}

You have a semicolon after OnJoinedLobby() which is not valid C# syntax.

As a point of advice, use an editor with syntax highlighting like VS Code or Visual Studio. It will detect issues like this for you

maybe get rid of the semicolon on public override void OnJoinedLobby();

thanks! @DeveNuub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM