PunRPC getting lost for seemingly no reason.

Hi there!

Repost because about only a few people even saw my first one. I am trying to implement a global chat system. The code is quite self-explanatory, but the main idea is just that every time a client enters some text and hits enter, that new text is sent to all the clients, which then add the new text to the previous text.

After countless documentation readings, forum scrawlings, and head bangings, I have no idea why it doesn't work. I am here to answer and assist as much as I can. Likely, it's something incredibly obvious that I missed.


using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;

public class GlobalChatScript : MonoBehaviour
    [SerializeField] private InputField InputText;
    [SerializeField] private GameObject GlobalChatText;
    [SerializeField] private GameObject PauseMenu;
    [SerializeField] private GameObject NameMenu;
    [SerializeField] private PlayerMovement3 PlayerMover;

    private bool inputMenuActive = false;

    [SerializeField] private int maxTextLength;

    void Update()
        if (Input.GetKeyDown(KeyCode.T) && !inputMenuActive && !PauseMenu.activeInHierarchy && !NameMenu.activeInHierarchy)
            //Open chat input, lock player movement, free cursor, select chat input
            inputMenuActive = true;
            PlayerMover.freeMovement = false;
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible = true;

        if (inputMenuActive && this.GetComponent<PhotonView>().IsMine && Input.GetKeyDown(KeyCode.Return))
            //Immediately close this conditional, update the chat
            inputMenuActive = false;

    public void UpdateMyChat()
        //Grab new text, wipe text
        string setText = this.GetComponent<PhotonView>().Owner.NickName + ": " + InputText.text;
        InputText.text = "";

        //Close chat input, resume player movement, lock mouse
        PlayerMover.freeMovement = true;
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
        Debug.Log(this.GetComponent<PhotonView>().ViewID + " | SentMessage | " + setText);

        //Send PunRPC
        this.GetComponent<PhotonView>().RPC("SetGlobalChatText", RpcTarget.All, setText);

    public void SetGlobalChatText(string textSet)
        //Put new text in front
        string set = textSet + "\n" + this.GlobalChatText.GetComponent<Text>().text;
        //Limit string size
        if (set.Length > maxTextLength)
            set = set.Substring(0, maxTextLength);

        //Update my chat
        Debug.Log(this.GetComponent<PhotonView>().ViewID + " | RecievedMessage | " + textSet);
        this.GlobalChatText.GetComponent<Text>().text = set;