반응형
- 코드 작성
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
using UniRx.Triggers;
using System;
public class DoubleClickUniRX : MonoBehaviour
{
public Text text;
void Start()
{
var clickStream = this.UpdateAsObservable()
.Where(_ => Input.GetMouseButtonDown(0));
clickStream.Buffer(clickStream.Throttle(TimeSpan.FromMilliseconds(200)))
.Where(x => x.Count >= 2)
.SubscribeToText(text, x => string.Format("DoubleClick detected:{0}", x.Count));
}
}
참고할만한 글
반응형