jorgegarcia / UnityOSC

Open Sound Control (OSC) C# classes interface for the Unity3d game engine
497 stars 124 forks source link

Get an OscBundle #20

Open davemod opened 7 years ago

davemod commented 7 years ago

Hey there. How do I get several Adresses and Values from an OSC Bundle when I receive OSC in Unity? I dont get that to work. Thank you very much in advance

David

jorgegarcia commented 7 years ago

Hi @davemod,

Please check the tests/oscControl.cs example script from the repository. From there you can read OSC Bundles as OSC Messages with the following:

UnityOSC.OSCMessage m = item.Value.packets[lastPacketIndex].Data[0] as UnityOSC.OSCMessage;
string address = m.Address;

Hope it helps!

Cheers, Jorge

Schroedingers-Cat commented 4 years ago

Hi @jorgegarcia,

related to this issue, is it possible to send an OscBundle with UnityOSC? If yes, do you have an example for this?

jorgegarcia commented 4 years ago

Hi @Schroedingers-Cat,

As far as I can see (and remember now) the OSC bundle packing is not implemented in this library, sorry. See below: https://github.com/jorgegarcia/UnityOSC/blob/237c15c737d8c5a8e3f9e3165cbd01f7ad0cb41c/src/OSC/OSCBundle.cs#L67

Best, Jorge

Schroedingers-Cat commented 4 years ago

Thanks for the reply!

It turned out that OSC Bundles wasn't what I needed. I want to send a message with a list of arguments like this /source/1/aed 0 0 1. I'm currently unsure how this feature is called in the OSC spec - but does this library support sending consecutive arguments in a message?

jorgegarcia commented 4 years ago

Hi @Schroedingers-Cat,

Please see section 3 (usage) from the manual. You can send ranges of values in the same OSC address with UnityOSC:

https://github.com/jorgegarcia/UnityOSC/blob/master/docs/UnityOSC_manual.pdf

Hope it helps!

Jorge

Schroedingers-Cat commented 4 years ago

Thanks, this is working great!