error CS0103: The name 'PhotonNetwork' does not exist in the current context
Options
Hi, i'm trying out PUN 2 and this error came ( error CS0103: The name 'PhotonNetwork' does not exist in the current context ) and i don't know how to fix it. Please help
My script:
and here is a image of my Unity Project folder:
https://imgur.com/a/gYrJOUy
My script:
using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon; using UnityEngine.UI; public class PlayerNameInput : MonoBehaviour { [SerializeField] private InputField nameInputField = null; [SerializeField] private Button continueButton = null; private const string PlayerPrefsNameKey = "PlayerName"; private void Start() { SetUpInputField(); } private void SetUpInputField() { if(!PlayerPrefs.HasKey(PlayerPrefsNameKey)) { return; } string defaultName = PlayerPrefs.GetString(PlayerPrefsNameKey); nameInputField.text = defaultName; SetPlayerName(defaultName); } private void SetPlayerName(string defaultName) { continueButton.interactable = !string.IsNullOrEmpty(name); } public void SavePlayerName() { string playerName = nameInputField.text; PhotonNetwork.NickName = playerName; PlayerPrefs.SetString(PlayerPrefsNameKey, playerName); } }
and here is a image of my Unity Project folder:
https://imgur.com/a/gYrJOUy
0
Comments
-
Please try ;
using Photon.Pun;
instead of using Photon;1 -
Oh, Thanks0