Login Register


i need help filter_list
Author
Message
i need help #1
Hi
I have a problem....
(3,14): error CS0234: The type or namespace name `Chat' does not exist in the namespace `Photon'. Are you missing an assembly reference?
(12,46): error CS0246: The type or namespace name `IChatClientListener' could not be found. Are you missing `ExitGames.Client.Photon.Chat' using directive?
(18,28): error CS0246: The type or namespace name `ChatClient' could not be found. Are you missing `ExitGames.Client.Photon.Chat' using directive?
(89,39): error CS0246: The type or namespace name `ChatState' could not be found. Are you missing `ExitGames.Client.Photon.Chat' using directive?

Code:
using UnityEngine; using UnityEngine.UI; using Photon.Chat; namespace Visyde {     /// <summary>     /// Chat System     /// - manages the chat system itself as well as the chat's UI in one script     /// </summary>     public class ChatSystem : MonoBehaviour, IChatClientListener     {         [Header("References:")]         public Text messageDisplay;         public InputField inputField; [HideInInspector] public ChatClient chatClient;         public bool HasChatAppID{ get{                 return !string.IsNullOrEmpty(PhotonNetwork.PhotonServerSettings.ChatAppID);             } }         // Internals:         VerticalLayoutGroup vlg;         // Use this for initialization         void Start()         {             vlg = messageDisplay.transform.parent.GetComponent<VerticalLayoutGroup>();         }         // Update is called once per frame         void Update()         { if (chatClient != null)             {                 chatClient.Service();             }             // Functionalities:             if (Input.GetKeyDown(KeyCode.Return)){                 SendChatMessage();             }         }         public void ConnectToChat(){             if (HasChatAppID)             {                 // Only connect if we have a chat ID specified in the PhotonServerSettings:                 chatClient = new ChatClient(this);                 chatClient.Connect(PhotonNetwork.PhotonServerSettings.ChatAppID, Connector.instance.gameVersion, new Photon.Chat.AuthenticationValues(PhotonNetwork.playerName));             }         }         public void SendChatMessage(){             if (!string.IsNullOrEmpty(inputField.text))             {                 chatClient.PublishMessage(PhotonNetwork.room.Name, inputField.text);                 inputField.text = string.Empty;             }         }         public void SendSystemChatMessage(string message){             DisplayChat(message, "", false, true);         }         void DisplayChat(string message, string from, bool ours, bool systemMessage){             string finalMessage = systemMessage ? "\n" + message + "" : "\n[" + (ours ? "<color=cyan>" : "<color=white>") + from + "</color>]: " + message;             messageDisplay.text += finalMessage;             // Canvas refresh:             Canvas.ForceUpdateCanvases();             vlg.enabled = false;             vlg.enabled = true;         }         // Photon stuff:         void OnJoinedRoom()         {             messageDisplay.text = "";             // Connect to the chat server when we join a room:             ConnectToChat();         }         void OnLeftRoom()         {             // Disconnect from the chat server when we leave a room:             chatClient.Disconnect();         }         public void OnChatStateChange(ChatState state)         {             // use OnConnected() and OnDisconnected()             // this method might become more useful in the future, when more complex states are being used.             //this.StateText.text = state.ToString();         }         public void OnStatusUpdate(string user, int status, bool gotMessage, object message) { }         public void OnGetMessages(string channelName, string[] senders, object[] messages)         {             int last = senders.Length - 1;             DisplayChat (messages[last].ToString(), senders[last], senders[last] == PhotonNetwork.playerName, false);         }         public void OnPrivateMessage(string sender, object message, string channelName)         {             // as the ChatClient is buffering the messages for you, this GUI doesn't need to do anything here             // you also get messages that you sent yourself. in that case, the channelName is determinded by the target of your msg             //this.InstantiateChannelButton(channelName);             byte[] msgBytes = message as byte[];             if (msgBytes != null)             {                 Debug.Log("Message with byte[].Length: " + msgBytes.Length);             }             /*if (this.selectedChannelName.Equals(channelName))             {                 ShowChannel(channelName);             }*/         }         public void OnUserSubscribed(string channel, string user)         {         }         public void OnUserUnsubscribed(string channel, string user)         {             Debug.LogFormat("OnUserUnsubscribed: channel=\"{0}\" userId=\"{1}\"", channel, user);         }         public void OnConnected()         {             chatClient.Subscribe(new string[] { PhotonNetwork.room.Name }, 5); // subscribe to the chat channel once connected to the chat server         }         public void OnDisconnected()         {             //ConnectingLabel.SetActive(false);         }         public void OnSubscribed(string[] channels, bool[] results)         {                     }         public void OnUnsubscribed(string[] channels)         {             /*foreach (string channelName in channels)             {                 if (this.channelToggles.ContainsKey(channelName))                 {                     Toggle t = this.channelToggles[channelName];                     Destroy(t.gameObject);                     this.channelToggles.Remove(channelName);                     Debug.Log("Unsubscribed from channel '" + channelName + "'.");                     // Showing another channel if the active channel is the one we unsubscribed from before                     if (channelName == selectedChannelName && channelToggles.Count > 0)                     {                         IEnumerator<KeyValuePair<string, Toggle>> firstEntry = channelToggles.GetEnumerator();                         firstEntry.MoveNext();                         ShowChannel(firstEntry.Current.Key);                         firstEntry.Current.Value.isOn = true;                     }                 }                 else                 {                     Debug.Log("Can't unsubscribe from channel '" + channelName + "' because you are currently not subscribed to it.");                 }             }*/         }         public void DebugReturn(ExitGames.Client.Photon.DebugLevel level, string message)         {             if (level == ExitGames.Client.Photon.DebugLevel.ERROR)             {                 UnityEngine.Debug.LogError(message);             }             else if (level == ExitGames.Client.Photon.DebugLevel.WARNING)             {                 UnityEngine.Debug.LogWarning(message);             }             else             {                 UnityEngine.Debug.Log(message);             }         }     } }


Can you help

Reply

RE: i need help #2
First of all, this is in the wrong section, @mothered can you take care of moving this?

Secondly, your error list tells you everything you need to know. "Photon.Chat" is very likely not the correct namespace, you'll need to fully qualify it by writing
Code:
using ExitGames.Client.Photon.Chat;
instead of
Code:
using Photon.Chat;
(This post was last modified: 08-30-2020, 05:33 PM by phyrrus9.)

[+] 1 user Likes phyrrus9's post
Reply

RE: i need help #3
Thanks man!
What is the section

Reply

RE: i need help #4
Moved from the C, C++, & Obj-C forum to Coding.
[Image: AD83g1A.png]

Reply







Users browsing this thread: