Version: 2019.4
public bool HasCharacter (char c);

パラメーター

cチェックする文字

戻り値

bool フォントが指定した文字を持っているかどうか。

説明

フォントが特定の文字列を扱えるかを判断します

この関数はフォントが指定した特定の文字を定義されているかを確認します。フォントによってはすべての文字が定義されていないこともあります(例えば、記号や小文字が定義されていない、という場合)。

using UnityEngine;

public class FontCheck : MonoBehaviour { // Detects if the current font of a 3D text // supports '-' sign TextMesh t; void Start() { t = transform.GetComponent<TextMesh>(); if (t.font.HasCharacter('-')) { Debug.Log("Font supports '-' sign."); } else { Debug.LogWarning("This font doesnt support '-'"); } } }