Photon pun 2 not working with Photon.PunBehaviour

On unity 2020.3.44f1 i have installed photon pun 2 and when i went to script a script for it and finnished it i got this error.
Assets\Scripts\Lobby\LobbyManager.cs(6,36): error CS0234: The type or namespace name ‘PunBehaviour’ does not exist in the namespace ‘Photon’ (are you missing an assembly reference?)
I have used the Photon.PunBehaviour in the public class And i have re imported the entire project then the library folder then the ScriptAssemblies folder Now i lost the Assembly-C#.dll file from that. Nothing worked. I even re downloaded and imported the package from the package manager. When i import it it says all assets from this package are already in your project. Nothing to import. It only shows Pun 2 package in the my assets sction of the package manager. But not the in project. I have literly ran out of options on how to fix it. I cant find specific fix for it online. My assistant keeps telling me to download the unity package from the photon web site but it onlys redirects me to the unity asset store. Do you know how to fix it?
this is the code is it wrong?

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

public class LobbyManager : Photon.PunBehaviour
{

    string GameVersion = '1';

    // Start is called before the first frame update
    void Start()
    {
        if (!PhotonNetwork.connected)
        {
            PhotonNetwork.autoJoinLobby = false;

            PhotonNetwork.automaticallySyncScene = true;

            PhotonNetwork.ConnectUsingSettings(GameVersion);
        }
    }

    public override void OnConnectedToMaster()
    {
        print("Connected to Master");
        PhotonNectwork.JoinLobby();
    }

    public override void OnJoinedLobby()
    {
        print("Connected to Lobby");
    }
}

Have you checked that you haven’t inadvertently got another class or Namespace called Photon in your project?

Did you import the package? Check if this folder (among others) exists: Assets\Photon\PhotonUnityNetworking.
Sometimes it is necessary to force Unity to re generate the project files. You could delete the Library folder and the *.csproj and *.sln files (those should all just be generated by Unity, so they are not even in Version Control most likely).

Yes i did and i only had like 3 scripts that ive created and none of them have the same names

If you did not see i alredy imported the package from the package manager. Also even from the asset store. I just dont get why it always works for others and not me.

I don’t know where you got that code but since a while, PUN 2 uses MonoBehaviourPun and MonoBehaviourPunCallbacks. Maybe you copied this from an outdated tutorial?
Hope you found that already.

Ive tried both thoes and they dont work im TELLING you i have everything thats requierd is installed. I DONT GET HOW it works for others but not me out of all the people in the world it has to be me.
An error =
Assets\Scripts\Lobby\Rooms\CreateRoom.cs(9,27): error CS0246: The type or namespace name ‘MonoBehaviourPun’ could not be found (are you missing a using directive or an assembly reference?)

I just fiquerd it out you had to add
using Photon.Realtime; at the top

1 Like