Please Help-me Upgrade Script Errors
Options
TyHover
✭
Hello everyone, I want to update the active (PUN) for a current version and some errors appear for someone to take a look at my script below:
ERROR 1:
error CS1502: The best overloaded method match for `ChatDemo.AddChatMessage(string, PhotonMessageInfo)' has some invalid arguments
error CS1503: Argument `#2' cannot convert `null' expression to type `PhotonMessageInfo'
protected virtual void Send() { if (!string.IsNullOrEmpty(m_InputLine)) { if (MessageOK(-1, m_InputLine)) AddMessage(m_InputLine); else { switch(FilterMode) { case MessageFilterBehavior.Alert: PlaySound(m_Chat.ChatErrorSound); break; case MessageFilterBehavior.Silent: AddChatMessage(GetFormattedPlayerName(PhotonNetwork.player.ID) + m_InputLine, null); PlaySound(m_Chat.ChatSound); break; } } SnapToBottom(); } m_InputLine = ""; GUI.FocusControl(""); ShowTextInput(false); }
LINE ERROR: AddChatMessage(GetFormattedPlayerName(PhotonNetwork.player.ID) + m_InputLine, null);
ERROR 2:
error CS0019: Operator `!=' cannot be applied to operands of type `PhotonMessageInfo' and `null'
[PunRPC] void AddChatMessage(string message, PhotonMessageInfo info) { bool shouldSnapToBottom = IsViewAtBottom; if (ViewRectHeight > LogPixelHeight) shouldSnapToBottom = true; string prefix = ""; if (info != null) { if (!MessageOK(info.sender.ID, message)) return; prefix = GetFormattedPlayerName(info.sender.ID); if (message.Length > MaxMessageLength) message = message.Remove(MaxMessageLength); PlaySound(m_Chat.ChatSound); } while (message.Length > 0) { string s = ((string.IsNullOrEmpty(prefix)) ? "" : prefix); if (m_HaveSkin) { while ((message.Length > 0) && TextStyle.CalcSize(new GUIContent(s)).x < m_ViewRect.width - 16) { s += message[0]; message = message.Substring(1); } } else { s = message; message = ""; } m_Messages.Add(s); } if (m_Messages.Count > MaxMessages) m_Messages.Remove(m_Messages[0]); if (shouldSnapToBottom) SnapToBottom(); }
LINE ERROR: if (info != null)
0
Comments
-
Help0