Documentation for the Unity C# Library
Loading...
Searching...
No Matches
NoAllocToggleListener.cs
Go to the documentation of this file.
1using PixoVR.Core;
2using System;
3using System.Collections.Generic;
4using System.Linq;
5using System.Text;
6using UnityEngine;
7
8public class NoAllocToggleListener : MonoBehaviour
9{
10 private int counter;
11 private Action<TextMessage> handler;
12
13 private void Awake()
14 {
15 handler = (TextMessage msg) => ++counter;
16 }
17
18 private void Update()
19 {
20 EventBetter.Listen(this, handler);
22 }
23}
Action< TextMessage > handler
Intentionally made partial, in case you want to extend it easily.
static bool UnlistenAll(UnityEngine.Object listener)
Unregisters all message types for a given listener.