public void CreateChatEntry(string message, Color inPlayerColor) { UIChatEntry chat = GameObject.Instantiate(chatPrefab).GetComponent <UIChatEntry>(); chat.ShowMessage(message, inPlayerColor); PositionEntryInGrid(chat.gameObject); NetworkServer.Spawn(chat.gameObject); }
public void OnEntryClicked(UIChatEntry entry) { if (!string.IsNullOrWhiteSpace(entry.message.replyPrefix)) { messageInput.text = entry.message.replyPrefix; messageInput.Select(); Invoke(nameof(MoveTextEnd), 0.1f); } }
// called by chat entries when clicked public void OnEntryClicked(UIChatEntry entry) { // any reply prefix? if (!string.IsNullOrWhiteSpace(entry.message.replyPrefix)) { // set text to reply prefix messageInput.text = entry.message.replyPrefix; // activate messageInput.Select(); // move cursor to end (doesn't work in here, needs small delay) Invoke(nameof(MoveTextEnd), 0.1f); } }