If I’m typing something in the Inspector inside the ui text it looks like that :
But when I’m clicking the keypad numbers in the game it self the numbers are overwrite each other and it’s showing each time only one number :
For example I clicked on 1 and then on 2 but 2 replaced 1 instead adding the 2 near the 1 :
On each key in the keypad I added this script :
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
public class SecurityKeypadKeys : MonoBehaviour
{
public TextMesh text;
private void Start()
{
}
private void OnMouseDown()
{
string[] digits = Regex.Split(transform.name, @"\D+");
foreach (string value in digits)
{
int number;
if (int.TryParse(value, out number))
{
text.text = number.ToString();
}
}
}
}

