Example #1
0
    protected override void Init()
    {
        touchControls = new TouchInput();
        touchControls.Enable();

        touchControls.Touch.TouchPress.started  += OnPress;
        touchControls.Touch.TouchPress.canceled += OnRelease;
        touchControls.Touch.TouchHold.started   += OnDrag;
        touchControls.Touch.Back.started        += OnBack;

        touchPosition = touchControls.Touch.TouchPosition;
    }
Example #2
0
    public void EnableInput()
    {
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBPLAYER
        if (_nontouchInput == null)
        {
            _nontouchInput = GetComponent <NontouchInput>();
        }
        _nontouchInput.Enable();
#elif (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
        if (_touchInput == null)
        {
            _touchInput = GetComponent <TouchInput>();
        }
        _touchInput.Enable();
#endif
    }