Created
November 20, 2017 06:21
-
-
Save kyubuns/d0609398e71e16bb87a5451c72963391 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
using UniRx; | |
using UnityEngine; | |
public class Sample1 : MonoBehaviour | |
{ | |
public async Task Start() | |
{ | |
var input = await MessageBroker.Default.Receive<Hoge>().First(); | |
Debug.Log($"Result: {input.Value}"); | |
} | |
public void Update() | |
{ | |
if (Input.GetKeyDown(KeyCode.A)) | |
{ | |
MessageBroker.Default.Publish(new Hoge(123)); | |
} | |
} | |
} | |
public class Hoge | |
{ | |
public Hoge(int value) | |
{ | |
Value = value; | |
} | |
public int Value { get; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment