Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[RELEASED] UniOSC - OSC solution for Unity

Discussion in 'Assets and Asset Store' started by _monoflow, May 21, 2014.

  1. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Version 1.6 submitted

    Important!:
    If you update an old project you will loose most of your component settings.You also have to remove the old UniOSC folder before importing.

    • Sending OSC Bundle support
      • A OSC Bundle encapsulates several OSC messages into one package to reduce network traffic overhead
      • You can always change between the old Message mode (default) and the Bundle mode.
    • OSCEventArgs has now the Packet property (OscPacket) instead of a Message property for supporting OscMessages and OscBundles
      • If you have legacy code where you access the message of a UniOSCEventArgs object you have to change it this way: OscMessage msg = ((OscMessage)my UniOSCEventArgsObj.Packet);
    • Changing a property of a Dispatcher/EventTarget (from inspector or via code) now works transparently
      • No need for manually re-enable your component/class (auto-reconfiguration)
      • Reduced the amount of code a lot if you look at the TestEditor Script
    • AppendData is much more flexible
      • You don't have to enable your dispatcher/eventTarget before add some data.
      • Data is now persistent. No need to reassign your data when your component is disabled once.
      • Works in Message and in Bundle mode almost the same way:
        • Message mode: AppendData(myDataType);
        • Bundle mode: AppendData( myOSCMessage);
    • New demo classes
      • MultiAddressSender to show how to send multiple OSC messages with one script (several individual messages or one bundle)
      • MultiConnectionSender to show how to send one message or bundle via several connections with one script.
    • Flux Timeline Editor support
    • Cleanup folder structure
      • All code that relies on external assets are now under UniOSC/scripts/External.
      • Some Editor classes are rearranged into new folders.
    • Documentation update
    Sorry that this update don't work so smooth with old code, but now the system is much more flexible! The behaviour for changing the properties of your Dispatchers/Connections/EventTargets is now the same regardless if you access them via code or via the inspectors and the auto-reconfiguration is much improved.
     
  2. hmb3141

    hmb3141

    Joined:
    Oct 8, 2014
    Posts:
    17
    Hi, this looks to be by far the best OSC library for Unity. I can't see information on whether it supports bonjour though?
     
  3. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Bonjour is a different technology so UniOSC doesn't has this feature right out of the box. There is a third party asset I'm aware of : OneTouchConnect that you could use for this. The Bonjour layer is only responsible for getting or providing the IPaddresses so you have to write some code that configures a OSCConnection with a discovered IPaddress. I don't have plans to implement a Zeroconf/Bonjour feature by my self as this could be a nightmare if you want it cross-platform, so i rely on a third party solution. But it is a good feature for one of the next releases of UniOSC. (When OneTouchConnect supports Unity5 i could write the scripts so that UniOSC could use OneTouchConnect for the Bonjour feature.)
     
  4. Veggie

    Veggie

    Joined:
    Apr 3, 2013
    Posts:
    5
    This looks great, one small thing though, the thread description says that you still still need Unity Pro for mobile support?

    Edit: Ignore that, I just read the full thread(properly this time :p), everything is fine. This is a definite purchase for me BTW.
     
  5. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Cool! :cool::D
     
  6. ProtoJazz

    ProtoJazz

    Joined:
    Nov 27, 2012
    Posts:
    19
    Somewhat unrelated to your asset its self, but I was having trouble figuring out where to put.
    Im interested in OSC, and I see some benefits to it, but I honestly just dont really understand why I should use it,

    For example lets say Im wanting to make a Unity Game that players interact with 1 devices with other devices.
    So each player could have a networked app running on their phone running unity and sending messages through photon
    or Alljoyn or any other networking setup.

    Or They could use an App that just implements OSC and has the proper controls defined.

    What I dont know is if one option is better, or why.

    My guess would be OSC seems possibly faster, its also platform/transmission agnostic, as In if I decide Im tired of people using their phones for my game I could swap in homemade arduino controllers or something.

    OSC also seems to have a bigger presence in interacting with physical things FROM unity, like sending messages to robots and other things.

    Are any of these ideas correct? Or am I just totally lost?
     
  7. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    You are correct. There are a couple of ways to get a distributed system with Unity. You only have to be aware of the pro & cons of every solution. OSC fits best if you have a heterogeneous system(Unity <-> other software). OSC is mainly used in the creative coding field (Openframeworks, Processing,Cinder,Max/MSP..) and as it was designed to be a successor of MIDI so you see a lot of music related projects that use OSC. If you want to make a multiplayer game then OSC would not be the best option for all the network related communication. OSC only supports a couple of datatypes so you can't send custom data objects you use in your game. OSC is based on UDP so it is fast but not reliable. The best use case is if you send continuously status information , so when one package is lost it doesn't matter so much.
     
  8. Visual_Lies

    Visual_Lies

    Joined:
    Nov 3, 2014
    Posts:
    17
    _monoflow I was hoping you would help me with some code updates on an git branch I built off Keijiro Takahashi's Reaktion. This script takes all the components from the Reaktion library using OSC and sets up and initializes the addresses then feeds data to them.

    I am not the most competent of coders and your most recent update threw me for a bit of a loop on how I need to adapt this code.

    https://github.com/noiseismyart/Rea...s/Reaktion/ReaktionUniOSC/UniOSCtoReaktion.cs
     
  9. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Did you read this or the manual? To get the OSC Message you now have to do a typecast on the Packet:
    Code (CSharp):
    1.  
    2. OscMessage msg = ((OscMessage)my UniOSCEventArgsObj.Packet);
    In your case you can change:
    Code (CSharp):
    1.  float value = (float)args.Message.Data[0] ;
    2.  
    to
    Code (CSharp):
    1.  float value = (float) ((OscMessage)args.Packet).Data[0] ;
     
  10. Visual_Lies

    Visual_Lies

    Joined:
    Nov 3, 2014
    Posts:
    17
    Thank you as I said I am not the most competent coder and typecasting like that is something still new to me. I spend most of my time in playmaker.
     
  11. theotherstudio13

    theotherstudio13

    Joined:
    Oct 8, 2009
    Posts:
    46
    hi @_monoflow this OSC package looks really cool and I have a few questions. I have a custom audio toolset built in unity maintained by an audio programmer I work with. I'd like to find out if your OCS package might allow us to send messages from Touch OSC that are mapped to play sounds by calling into our audio manager at runtime. Also I'd like to send and receive Unity mixer volume and effects parameters to and from Touch OSC so I can remote control the mixer and effects while the game is running. Do you think this might be possible ?
     
  12. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi,
    it should be no problem to create a solution for your project. I'm not familiar with the new Unity Audio mixer API but i guess that everything is scriptable. So you have to create a custom script based on the blueprints that came with UniOSC. You can create a Component based script for visual setup of your component and add some custom scripting for sending OSC messages from this . Best is to read the documentation from the UniOSC site to get a picture . If you have problems you can contact me or pm me and i can provide a custom script that should help you with most of the OSC related stuff.
     
  13. theotherstudio13

    theotherstudio13

    Joined:
    Oct 8, 2009
    Posts:
    46
    Fantastic .. thanks for the reply and invitation to help .. I'll buy the package and and start working on this
     
  14. krautsourced

    krautsourced

    Joined:
    Dec 3, 2012
    Posts:
    4
    Hi,

    has anyone tried UniOSC in the Web Player? I'd love to know if it works out of the box or if there are some further things to do regarding the enhanced socket security stuff that's active in the web player...

    Cheers
     
  15. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Version 1.7 submitted
    • Multicast & Broadcast support
      • In the OSCConnection component you specify now the transmission type (Unicast, Multicast or Broadcast)
    • Improved IP address validation
      • The OSCConnection inspector gives visual feedback if a chosen IP address is not valid. At runtime you get error messages in the console that makes debugging easy.
    • OSCSharp.dll update
    • Documentation update

    With the new multicast/broadcast option it is now very easy to create 'one to many' systems. If you use the multicast mode you can send messages to a whole group , with the broadcast mode you send data to all clients on your network. The unicast mode is the default way like before ('point to point' communication).
     
  16. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    227
    Hey, Thanks for the great asset! But I need your help!

    I'm working on a project which needs data transfer between stand alone mac and multiple iOS devices.
    The data transfer works just fine with a router that is connected to the internet.
    But when the router is disconnected from the internet, iOS app launch is delayed(lt looks like the app is waiting for internet access, I guess, for about 20 to 30 seconds), and the data transfer doesn't work well.

    The delayed launch and waiting occurs only when the AP is not connected to the internet. I tested with same AP, connected to the Internet / not connected to the internet.

    Does the UniOSC requires, or checks internet access?

    Oh, I have one more question.
    The host computer's OSC IN IP is not consistent across different APs.
    Some AP shows that the OSC IN IP is local(192.168.x.x),
    while some other AP shows that as non-local(?), oh,, I forgot the numbers... It wasn't 192.168.x.x anyway.
     
  17. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    There could be a problem with the GetLocalIPAddress call when you have no Internet access.
    For a quick solution you can change in UniOSCConnection.cs at the Init() method (line 501) :
    Code (CSharp):
    1. if (localIPAddress == null) localIPAddress =  UniOSCUtils.GetLocalIPAddress();
    to
    Code (CSharp):
    1. if (localIPAddress == null) localIPAddress = "127.0.0.1";
    So you alway use the local loopback address which also should work. (I tested it on my system and it worked)
    If you use the UniOSCGUI.cs class from the mobile scene you can do the same at OnEnable() to prevent some delay from DNS resolving.
     
  18. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Unity 5.3 comes with some changes that causes some confusion:
    If you open and old project with Unity 5.3 please check the platform in you publish settings.It seems that the WebGL platform is preselected which causes an exception.
    The new multi editing feature also forces a tiny change in the OSCConnection.cs file .
    Code (CSharp):
    1.     public void Awake(){
    2.           //comment out this line:
    3.             //DontDestroyOnLoad(gameObject);
    4.             Init();
    5. ....
    6. }
    The DontDestroyOnLoad line causes some weird effect. The OSConnections are no longer visible in the Hierachy.
    According to the docs it's better to remove this and make your own manager for handling cross scene references :
    ( http://docs.unity3d.com/Manual/MultiSceneEditing.html)

    I will fix this asap for the official release.
     
    NGC6543 and elbows like this.
  19. cloud_canvas

    cloud_canvas

    Joined:
    Mar 31, 2015
    Posts:
    14
    Hi _monoflow,

    Forgive me for asking a very basic question.

    I'm only a newbie to Unity and C# Scripting; I've been using OSC in custom-rolled Lemur / TouchOSC / Max/MSP / Processing / openFrameworks etc. setups for years.

    I've tried poking and prodding the documentation and the example scenes so that I can get a basic understanding of how to roll my own mappings of OSC address paths into in-game object parameters but it is just totally opaque to me.

    I've figured out from your terminology that what I'm trying to find is a start-to-finish walkthrough of how to implement a class-based solution. I've tried to use your UniOSC.ClassBased.unity Scene file as a reference but it still just makes absolutely no sense to me. You're creating five UniOSCEventTargetCBImplementation objects, there's two dispatchers, there's input and output flying all over the place, I don't fundamentally understand how any of this is interfacing with the OSCConnection Components...

    Can you just give me a really basic explanation of how I write a script that interfaces with a single OSCConnection input and, say, writes that to an in-game text label? I'm trying to think of the most barebones thing that I can. I've read that I'm supposed to use UniOSCEventTargetImplementation as a starting place but I don't understand how this script is formatted with all of the special UniOSC prompts since they're not publicly exposed in a script, I don't understand how to extend that class, so on and so forth.
     
  20. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi cloud_canvas,
    i made a script that is based on the UniOSCEventTargetImplementation class. As you will see i only added a reference to a UI.Text and in the OnOSCMessageReceived method i added the parsing:
    Code (CSharp):
    1.  textfield.text = ((OscMessage)args.Packet).Data[0].ToString();
    This is a component based example as it is easier to understand for a beginner. When you add this script to a gameobject you can do the settings via the component inspector. For a quick start you should just enable 'Receive all Addresses' and use the 'Explicit Connection' feature. Then you only add a OSCConnection reference to the 'selected Connection' and your ugui text to the textfield property.

    (I noticed that in the UniOSCEventTargetImplementation.cs there is missing a reference to the OSCsharp.Data namespace. I will update that for the official release. In the meantime just add this in your version:
    Code (CSharp):
    1. using OSCsharp.Data;
    The key to understand is that you can add your own properties in your script based on the UniOSCEventTargetImplementation .To make them visible in the component inspector just make them 'public' in your code.

    When you want a class based version you do the same but based on the UniOSCEventTargetCBImplementation.cs file. To listen to all Address patterns and use the explicit connection feature i would use this constructor:
    Code (CSharp):
    1. oscTarget = new YourUniOSCEventTargetCBImplementation(OSCAddress, OSCConnection);
    If you have more question please contact me directly via mail or PM me.
     

    Attached Files:

    cloud_canvas likes this.
  21. cloud_canvas

    cloud_canvas

    Joined:
    Mar 31, 2015
    Posts:
    14
    Thank you so much for the help, this is great.

    Is there some way to access the count of members in an OSC message payload? In your comments you say that this can be accessed by args.Message.Data.Count, but it's not in the API and Unity throws up an error saying that that doesn't exist. For now I'm having to squeeze my payloads down into singletons on individual address paths.
     
  22. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Sorry there are some old code in the comments of the script. You can get the count with this line:
    Code (CSharp):
    1.  int count = ((OscMessage)args.Packet).Data.Count;
    If you see any old code where you use 'args.Message' you now have to use '((OscMessage)args.Packet)'.
    In the old version you could access the OSCMessage directly but now you have to 'Cast' the 'args.Packet' to the type OSCMessage. (For coders this is not hard to understand but for non-coders it could be strange ;) )
     
    cloud_canvas likes this.
  23. cloud_canvas

    cloud_canvas

    Joined:
    Mar 31, 2015
    Posts:
    14
    Thanks _monoflow for such expedient assistance. I have another question: is there a class-based demo of sending OSC messages somewhere in the package?
     
  24. cloud_canvas

    cloud_canvas

    Joined:
    Mar 31, 2015
    Posts:
    14
    I should say that I'm trying to send OSC messages from the same script that I'm receiving and parsing them from - tricky because as I'm stretching my brain and getting fluent in thinking about OOP again as I simultaneously learn C#, Unity and UniOSC that I'd need to have multiple inheritance I think from both UniOSCEventTarget and UniOSCEventDispatcher and that's not possible. I don't mind breaking it up into two scripts, though, I suppose.
     
    Last edited: Jan 21, 2016
  25. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    In the "UniOSC/Scripts/ClassBased/Demo" folder is the script (UniOSCClassBasedDemo.cs) that is used in the UniOSC.ClassBased scene. So you can look at how to send data via scripting.
    And the corresponding class that is used for sending (UniOSCEventTargetCBImplementation.cs) is located in "UniOSC\Scripts\ClassBased\Example.Classes" .
    If you want to create your own class then you can duplicate this one and rename it.
     
  26. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    With one script this would not be possible but with a script(like in the class based demo) that has references to a Dispatcher and an EventTarget it would be possible .
     
  27. cloud_canvas

    cloud_canvas

    Joined:
    Mar 31, 2015
    Posts:
    14
    I'm sorry, I'm still not able to get this going. I've copied your example from UniOSCClassBasedDemo for sending and I'm still unable to get it to work. What am I doing wrong?

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UniOSC;
    4. using OSCsharp.Data;
    5.  
    6. public class wiimoteOSC1Sender : MonoBehaviour {
    7.   #region public
    8.   public UniOSCConnection connectionToWiimote1;
    9.   #endregion
    10.  
    11.   #region private
    12.   private UniOSCEventDispatcherCBImplementation oscSender;
    13.   #endregion
    14.  
    15.   void Awake() {
    16.     oscSender = new UniOSCEventDispatcherCBImplementation("/wii/1/vibrate", connectionToWiimote1);
    17.   }
    18.  
    19.   void OnEnable() {
    20.     oscSender.Enable();
    21.     oscSender.ClearData();
    22.   }
    23.  
    24.   public void sendVibesToWiimote1() {
    25.     print("hello");
    26.     oscSender.ClearData();
    27.     oscSender.AppendData(1);
    28.     oscSender.SendOSCMessage();
    29.   }
    30. }
    sendVibesToWiimote1() gets triggered externally by a UnityEvent. Additionally, I tried triggering it with a machine gun blast from Update() within this script. In neither case did I recieve the OSC payload on the other machine.
     
    Last edited: Jan 22, 2016
  28. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    When you create a new instance (oscsender) you have to use UniOSCEventDispatcherCBImplementation (Not UniOSCEventDispatcherImplementation)
     
  29. cloud_canvas

    cloud_canvas

    Joined:
    Mar 31, 2015
    Posts:
    14
    whoops, that was a typo on my part. I didn't copy and paste, I manually typed the source into the post. My actual source code file does use UniOSCEventDispatcherCBImplementation for construction, not UniOSCEventDispatcherImplementation.

    I edited it with the correction in case you'd like to copy/paste.
     
  30. cloud_canvas

    cloud_canvas

    Joined:
    Mar 31, 2015
    Posts:
    14
    _monoflow! My man. I figured out the problem. Had nothing to do with UniOSC. You're the best, thanks so much for the multi-day tech support!
     
  31. cloud_canvas

    cloud_canvas

    Joined:
    Mar 31, 2015
    Posts:
    14
    Do you plan to flesh out address path traversal so that it's more robust to other types of address path formats at some point? The example you laid out is very narrow with "/1/push8"-style messages being the only way to get anything useful out of Group, AddressRoot and AddressIndex.

    For example, it is requiring me to re-format all of my OSCulator Wiimote address paths so that rather than their default of

    /wii/1/button/A for the A button, and
    /wii/1/ir/x for the X position of the IR readings of the remote, they're formatted

    /1/a for the A button, and
    /1/irX for the X position of the IR readings of the remote.

    Apparently, this is somewhat strung up by the awkwardness of String operations in C#. Still, it makes address path parsing only marginally feature complete and not very useful without a more flexible syntax.
     
  32. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    It's impossible to create a parsing solution that fits all requirements. So i only added some solution that handles at least the format that TouchOSC use. In your case you can do something like this:
    Code (CSharp):
    1. OnOSCMessageReceived(UniOSCEventArgs args){
    2.  
    3. string[] s =  args.Address.Split('/');
    4. for(int i = 0;i< s.Length;i++){
    5. Debug.Log(s[i]);
    6. }
    7.  
    8. ....
    9. }
    If i read the WiiMote Address the right way you should have at s[4] the string "A" or "x" so you can do something like this:
    Code (CSharp):
    1.  
    2. switch(s[4]){
    3. case "A":
    4. .....
    5. break;
    6. case "x":
    7. ....
    8. break;
    9. }
    10.  
    11.  
     
  33. Felipe-Brito

    Felipe-Brito

    Joined:
    May 23, 2013
    Posts:
    5
    Hi @_monoflow !
    When I add an OscConnection in my project the gameobject simply is destroyed.
    I'm using OSX version, this problem happens just with me ?
    Best regards,
    Brito
     
  34. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
  35. gabrielefx

    gabrielefx

    Joined:
    Mar 2, 2016
    Posts:
    5
    Hi,
    I'd like to purchase this plugin.
    Does it work with Android console? For example the Nvidia Shield Android TV.
    Also...
    is it possible to trigger Playmaker states?
    I'm not a programmer, I'm using this plugin to build some interactive 3d animations.

    regards
     
  36. michael908

    michael908

    Joined:
    Dec 13, 2012
    Posts:
    3
    Hi!

    I'm trying to use UniOSC to communicate with multiple Android devices. With a single one using a Unicast to a known IP, this works fine. However, I'll have to send the OSC messages to dozens at the same time, thus I'd have to have the devices listen on a multicast address (I've been using 224.0.1.0 for now). On my Desktop machines this works fine, however the Android devices only listen on their own IP, not the multicast one. Is there anything extra that needs to be configured for this?

    Cheers!
     
  37. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Just an info for others that have the same problem with multicast on Android: http://stackoverflow.com/questions/...ot-receive-multicast-packet/23537607#23537607
    224.0.0.251 works
     
  38. EPFLECALLAB

    EPFLECALLAB

    Joined:
    Jun 8, 2016
    Posts:
    1
    Hello,
    I just bought the plugin but I have some trouble with message sending... I receive it twice... I don't know why?
    Can someone help?
    Thanks!

    Example of the code:
    ---------------------------------------------------------------------------------------
    Send code:
    --------------------------------------------------------------------------------------
    SetBundleMode (true);
    ClearData ();

    OscMessage v_message = new OscMessage (/Address1);
    v_message.Append (v_struct.a);
    v_message.Append (v_struct.b);
    v_message.Append (v_struct.c);
    v_message.Append (v_struct.d);
    v_message.Append (v_struct.e);
    v_message.Append (v_struct.f);
    v_message.Append (v_struct.g);
    v_message.Append (v_struct.h);
    v_message.Append (v_struct.i);
    v_message.Append (v_struct.j);

    AppendData (v_message);

    _SendOSCMessage (_OSCeArg);

    ---------------------------------------------------------------------------------------------------------------------------
    Receive code (in another file):
    -----------------------------------------------------------------------------------------------------------------

    public override void OnOSCMessageReceived(UniOSCEventArgs args){

    if (String.Equals (args.Address, /Address1)) {

    }
    if (String.Equals (args.Address, /Address2)) {

    }
    if (String.Equals (args.Address, /Address3)) {

    }
    }
     
  39. jojoh

    jojoh

    Joined:
    Jan 22, 2013
    Posts:
    15
    Hello UniOSC,

    I've got a (bit urgent) question. I purchased this asset for its capability to receive packages and not just messages. I hope my definition of packages is correct. But I'm sending multiple floats in one package to Unity, but I am not seeing any reponse from any scene. Single floats are okay, I've read the relevant parts of the manual and this part:

    OSCEventArgs has now the Packet property (OscPacket) instead of a Message property for supporting OscMessages and OscBundles
    • If you have legacy code where you access the message of a UniOSCEventArgs object you have to change it this way: OscMessage msg = ((OscMessage)my UniOSCEventArgsObj.Packet);
    Do you have any code I could use in the classbased example to retrieve my floats? :)

    It seems that the latest version is already prepared for packages, yet I don't see any incoming data.

    Thank you in advance.
     
  40. cyberluke

    cyberluke

    Joined:
    Sep 4, 2016
    Posts:
    10
    If I have 10 OSC devices and I'm running your plugin with Unity on Android. How can I provide user with some connection dialog or autoconnect to all of my devices? There cannot be hard-coded IP as it must work when traveling across different Wi-Fi networks.
     
  41. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    Hi, for your problem you probably need some additional system like ZeroConf/Bonjour to get the IpAddresses of your devices. But this is out of the scope from UniOSC.
    For a manual solution UniOSC comes with a mobile demo scene where there is a demo GUI for setting the ipaddress/port for a connection.
     
  42. fr_unity

    fr_unity

    Joined:
    Sep 8, 2016
    Posts:
    7
    Hi _monoflow, I am sorry to disturb you with a basic question. I am developing VR apps, and trying to find a way to send OSC messages to Max/Msp or Pure Data. I have researched a practical example that shows me how to implement your assets with Max/Msp or Pure Data, but nothing.

    Would you be so kind to give me some help? Thanks
     
  43. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    This is more a problem of setting the right ipAddresses and the right port in your OSC connection on each side of the communication.Otherwise there is nothing special to other OSC solutions. You can start with the mobile demo scene where there are two buttons that send some data. Then you can check if data comes into Max/PD. The other way it is best to just start with a uniOSCConnection and use the uniOSC Editor to trace if OSC data comes in. If you have managed to get data between both sites you can go further with the uniOSC components. Thre documentation should give you answers to most of your questions.
     
  44. DCrosby

    DCrosby

    Joined:
    Jan 13, 2013
    Posts:
    86
    This experience:



    was done through UNI-OSC, and one of the things that was a bit difficult, and we'd like to have as a feature in a new version would be to be able to dump the OSC data to a log file, possibly with timestamps, so we can see how fast data is coming in, and what the sequence of events is. Also possibly only logging input or output, or logging to two separate txt files.

    We also had a situation that when we spammed Uni-OSC with messages, we then we lost framerate, because of the "While" in the receiver, which caused it to not release the frame for rendering until it was done parsing all the data, which for VR was a bit of a headache, and we reduced the data flow so that was not our bottleneck.

    Other than the debugging headaches of how the data was being received, how fast, and what order Uni-OSC was very handy and bug free. We thoroughly enjoyed working with the software.

    -Derek
     
    Last edited: Oct 18, 2016
  45. gamedevluuk

    gamedevluuk

    Joined:
    Jun 23, 2014
    Posts:
    12
    Hi _monoflow,

    Do you know any solutions for our problem? We are sending through a lot of data from OpenFrameworks to Unity. UniOsc just stops receiving as if it overflows. If we manually disconnect / connect again we get messages again but after a second or so it seems to overflow and stop with receiving data. We are sending packages with about 6.6 KB per frame.

    Edit: by sending more messages with smaller size it works perfectly fine now!

    Thanks,
    Luuk
     
    Last edited: Oct 26, 2016
  46. contempt

    contempt

    Joined:
    Jul 31, 2012
    Posts:
    88
    Monoflow-
    I'm having issues with UniOSC on a Windows 10 machine running Unity release 5.4.2f2. I'm using 2 UniOSC connections on different ports where one connects to Touch Designer and the other connection receives commands from TouchOSC. If I run my project in the editor it works but if I stop playback and leave Unity then come back (typically editing script) Unity has frozen. I'm going to do more research on my side but thought I'd ask if there was anything you could recommend to fix and track down this issue. Thanks.
     
  47. ianjgrant

    ianjgrant

    Joined:
    Mar 11, 2013
    Posts:
    28
    Hi, I have a project with UniOSC (building an iOS client, a desktop, and several 'flavours' of the project) and I'm using Unity Cloud build. [1] Can I build a WebGL player (with no OSC functionality as it fails elegently) with the UniOSC libraries installed? currently I'm getting an error that may be UniOSC related:

    Code (CSharp):
    1. Assertion failed: 0 && "The target platform does not support Sockets", at: /mnt/Unity/Unity-5_5_0f3/Unity.app/Contents/il2cpp/libil2cpp/os/Generic/SocketImpl.cpp,48,SocketImpl at jsStackTrace (Default WebGL.js:1:19549)
    2. stackTrace (Default WebGL.js:1:19723)
    I'd like to build to different targets from the same project without removing libraries - as there are loads of common assets.
    [2] Does or can UniOSC fail elegantly on an unsupported build?

    Thanks, Ian
     
  48. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    This sounds strange. Does this happen when the UniOSC editor is closed ?
     
  49. _monoflow

    _monoflow

    Joined:
    Mar 26, 2014
    Posts:
    271
    At the moment there is no such feature implemented so you have to put all the related code inside a compiler directive:
    https://docs.unity3d.com/Manual/PlatformDependentCompilation.html
     
  50. gamedevluuk

    gamedevluuk

    Joined:
    Jun 23, 2014
    Posts:
    12
    hi _monoflow!

    Quick question here: is it possible to detect what IP sent the OSC message Unity receives? We want to know this because we want to ping back once in a while to see if the connection was interrupted.

    Thanks,
    Luuk