Skip to content

Instantly share code, notes, and snippets.

@kyubuns

kyubuns/Sample1.cs

Created Nov 20, 2017
Embed
What would you like to do?
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