Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
0埋めではない方
using UnityEngine;
using TMPro;
public class ShowCharacter2 : MonoBehaviour
{
[SerializeField]
TextMeshProUGUI label;
public int Count;
int[] characters = new int[5];
void Update()
{
var digit = (Count == 0) ? 1 : ((int)Mathf.Log10(Count) + 1);
var value = Count;
for (int i = digit - 1; i >= 0; i--)
{
characters[i] = (value % 10) + 48;
value /= 10;
}
label.SetCharArray(characters, 0, digit);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.