Git Product home page Git Product logo

Comments (3)

jorgegarcia avatar jorgegarcia commented on August 26, 2024

Hi Anton,

Your code seems correct. Please note that you can also access the actual data from each packet with something like the following setup below:

using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityOSC;

public class oscControl : MonoBehaviour {
    private Dictionary<string, ServerLog> servers;

    // Script initialization
    void Start() {  
        OSCHandler.Instance.Init(); //init OSC
        servers = new Dictionary<string, ServerLog>();
    }

    void Update() {

        OSCHandler.Instance.UpdateLogs();
        servers = OSCHandler.Instance.Servers;

        foreach(KeyValuePair<string, ServerLog> item in servers)
        {
            // If we have received at least one packet,
            // show the last received from the log in the Debug console
            if(item.Value.log.Count > 0) 
            {
                int lastPacketIndex = item.Value.packets.Count - 1;

                UnityEngine.Debug.Log(String.Format("SERVER: {0} ADDRESS: {1} VALUE 0: {2}", 
                                                    item.Key, // Server name
                                                    item.Value.packets[lastPacketIndex].Address, // OSC address
                                                    item.Value.packets[lastPacketIndex].Data[0].ToString())); //First data value
            }
        }
    }
}

UnityOSC doesn't support OSC bundle information yet, as it appears on the documentation. It would be your problem. Try to use another sender application (TouchOSC works for me), or bridge/filter the bundle information with another application. I am not sure if you can do that with netcat.

Hope it helps!

from unityosc.

dasantonym avatar dasantonym commented on August 26, 2024

hey jorge, thanks for the super fast response! i guess then the bundle format is the problem and as usual i didn't read the docs carefully enough... i will surely find a way to get around this!

thank you!

from unityosc.

jorgegarcia avatar jorgegarcia commented on August 26, 2024

No problem Anton! Just drop me an e-mail if you need more help.

Also feel free to implement the bundle support functionality. The UnityOSC library is an open project, collaborations are welcome :)

from unityosc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.