public override void OnEnable() { //Don't forget this!!!! base.OnEnable(); //here your custom code ClearData(); AppendData(data);//data at index [0] useExplicitConnection = true; if (!useExplicitConnection) { Debug.LogWarning("Please use the Explicit connection option!"); return; } if (connectionArray != null) { foreach (var c in connectionArray) { if (c == null) { continue; } UniOSCEventDispatcherCB oscSender = new UniOSCEventDispatcherCBSimple(oscOutAddress, c);//OSCOutAddress,OSCConnection //oscSender.ClearData(); oscSender.Enable(); /* * How to append messages to a bundle * oscSender.SetBundleMode(true); * * OscMessage msg1 = new OscMessage("/TestA"); * msg1.Append(data); * * * oscSender.AppendData(msg1); * oscSender.AppendData(new OscMessage("/TestB",data)); */ oscSender.AppendData(data); senderList.Add(oscSender); } } }
public override void OnEnable() { //Don't forget this!!!! base.OnEnable(); //here your custom code useExplicitConnection = true; if (!useExplicitConnection) { Debug.LogWarning("Please use the Explicit connection option!"); return; } //We append our data that we want to send with a message //later in the your "MySendOSCMessageTriggerMethod" you change this data //We only can append data types that are supported by the OSC specification: //(Int32,Int64,Single,Double,String,Byte[],OscTimeTag,Char,Color,Boolean) if (bundleMode) { SetBundleMode(true); ClearData(); AppendData(new OscMessage(oscOutAddress, data)); // Debug.Log(((OscBundle)_OSCeArg.Packet).Messages.Count); if (addressArray != null) { foreach (var d in addressArray) { if (String.IsNullOrEmpty(d)) { continue; } OscMessage msg = new OscMessage(d); msg.Append(data); AppendData(msg); } } // Debug.Log(((OscBundle)_OSCeArg.Packet).Messages.Count); } else { ClearData(); AppendData(data); if (addressArray != null) { foreach (var d in addressArray) { if (String.IsNullOrEmpty(d)) { continue; } UniOSCEventDispatcherCB oscSender = new UniOSCEventDispatcherCBSimple(d, explicitConnection);//OSCOutAddress,OSCConnection oscSender.AppendData(data); oscSender.Enable(); senderList.Add(oscSender); } } } }