Created
February 3, 2019 17:33
-
-
Save tsubaki/f88863d3c8e1b3c0a0c8fb963ab22991 to your computer and use it in GitHub Desktop.
SetCharArrayのChar版
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using TMPro; | |
public class ShowCharacter4 : MonoBehaviour | |
{ | |
[SerializeField] | |
TextMeshProUGUI label; | |
[Range(0, 99999)] | |
[SerializeField] | |
int count; | |
char[] characters = new char[5]; | |
const char zero = '0'; | |
void Update() | |
{ | |
var value = count; | |
for (int i = characters.Length - 1; i >= 0; i--) | |
{ | |
characters[i] = (char)((value % 10) + zero); | |
value /= 10; | |
} | |
label.SetCharArray(characters, 0, characters.Length); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment