Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SomeConsumer : MonoBehaviour
- {
- void floatsFromMic( float[] buf )
- {
- ...
- }
- Start()
- {
- MySingleton.Instance.theDelegate += new MySingleton.MicCallbackDelegate( floatsFromMic );
- }
- }
- using UnityEngine;
- using System.Collections;
- public class MySingleton : MonoBehaviour
- {
- public delegate void MicCallbackDelegate( float[] buf );
- public MicCallbackDelegate theDelegate;
- void Start ()
- {
- }
- void Update ()
- {
- !!! gather floats
- for( ? d in theDelegate.things )
- FIRE d
- }
- public void DoSomething()
- {
- }
- private static MySingleton _instance;
- public static MySingleton Instance
- {
- get
- {
- if( _instance == null )
- {
- GameObject go = new GameObject( "MySingleton" );
- _instance = go.AddComponent< MySingleton >();
- }
- return ( _instance );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment