Event.numeric

Unity · Версия 2020.3 LTS · Scripting · Event

Event.numeric

public bool numeric;

Описание

Находится ли текущая клавиша на цифровой клавиатуре? (Только чтение)

Используйте этот флаг, чтобы различать основные и цифровые клавиши.

using UnityEngine;

public class Example : MonoBehaviour
{
    // Creates a Label and prints Numeric Key pad is on/off
    // depending on the state of the numlock key.
    void OnGUI()
    {
        Event e = Event.current;
        if (e.numeric)
        {
            GUI.Label(new Rect(10, 10, 150, 20), "Numeric Key pad is on");
        }
        else
        {
            GUI.Label(new Rect(10, 10, 150, 20), "Numeric Key pad is off");
        }
    }
}

Обновлено 17 ноября 2026 г.