docs.unity3d.com
    目次を表示する/隠す

    Class EnhancedTouchSupport

    API to control enhanced touch facilities like Touch that are not enabled by default.

    Inheritance
    Object
    EnhancedTouchSupport
    Namespace: UnityEngine.InputSystem.EnhancedTouch
    Syntax
    public static class EnhancedTouchSupport
    Remarks

    Enhanced touch support provides automatic finger tracking and touch history recording. It is an API designed for polling, i.e. for querying touch state directly in methods such as MonoBehaviour.Update. Enhanced touch support cannot be used in combination with InputActions though both can be used side-by-side.

    public class MyBehavior : MonoBehaviour
    {
        protected void OnEnable()
        {
            EnhancedTouchSupport.Enable();
        }
    
        protected void OnDisable()
        {
            EnhancedTouchSupport.Disable();
        }
    
        protected void Update()
        {
            var activeTouches = Touch.activeTouches;
            for (var i = 0; i < activeTouches.Count; ++i)
                Debug.Log("Active touch: " + activeTouches[i]);
        }
    }

    Properties

    enabled

    Whether enhanced touch support is currently enabled.

    Declaration
    public static bool enabled { get; }
    Property Value
    Type Description
    Boolean

    True if EnhancedTouch support has been enabled.

    Methods

    Disable()

    Disable enhanced touch support.

    Declaration
    public static void Disable()
    Remarks

    This method only undoes a single call to Enable().

    Enable()

    Enable enhanced touch support.

    Declaration
    public static void Enable()
    Remarks

    Calling this method is necessary to enable the functionality provided by Touch and Finger. These APIs add extra processing to touches and are thus disabled by default.

    Calls to Enable and Disable() balance each other out. If Enable is called repeatedly, it will take as many calls to Disable() to disable the system again.

    See Also

    Touch
    Finger
    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)