Hi, im making a chat for my game, i do have the chat working but i can not make it work using text meshes insted of one text for everyone and i can only find how to do so with just one text. Can someone help me?
Msg Code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Message : Photon.MonoBehaviour {
public InputField messageField;
public TextMesh text;
GameObject player;
void OnJoinedRoom () {
if (text == null) {
if (photonView.isMine) {
text = GameObject.FindWithTag ("MessageText").GetComponent<TextMesh> ();
}
}
}
void Start(){
if (text == null) {
if (photonView.isMine) {
text = GameObject.FindWithTag ("MessageText").GetComponent<TextMesh> ();
}
}
}
void Update (){
if (photonView.isMine) {
if (Input.GetKeyDown (KeyCode.Return)) {
photonView.RPC ("SendMessage", PhotonTargets.All, messageField.text);
messageField.text = "";
}
}
}
[PunRPC]
void SendMessage(string message, PhotonMessageInfo info) {
text.text = message;
}
}