본문 바로가기
개발/Unirx

유니티 C# UniRX 타이머 간단 구현 Timer

by SPNK 2022. 8. 29.
반응형
  • 코드 작성
using System.Collections;
using System.Collections.Generic;
using UniRx;
using UnityEngine;
using UnityEngine.UI;

public class TimerUniRX : MonoBehaviour
{
    public Text timerText;

    private int timerIndex = 0;

    private void Start()
    {
        Observable.Timer(System.TimeSpan.FromSeconds(1))
        .Repeat()
        .Subscribe(_ => UpdateTimer());
    }

    void UpdateTimer()
    {
        timerIndex++;

        timerText.text = timerIndex.ToString();
    }
}

참고할만한 글

 

 

유니티 C# UniRX 코루틴 Coroution 간단 사용법

코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using UniRx; public class CoroutionUniRX : MonoBehaviour { private void Start() { Observable.FromCoroutine(ExampleCoroution, false) .Subscribe(_ => Debug.Log("Exit

parksh3641.tistory.com

 

 

유니티 C# UniRX ObservableWWW 간단 사용법

코드 작성 using System.Collections; using System.Collections.Generic; using UniRx; using UnityEngine; using UnityEngine.UI; public class ExampleUniRX : MonoBehaviour { private void Start() { var parallel = Observable.WhenAll( ObservableWWW.Get("http://

parksh3641.tistory.com

 

반응형

댓글