Giter VIP home page Giter VIP logo

Comments (12)

jorgegarcia avatar jorgegarcia commented on July 16, 2024

Hi, I'm afraid I don't quite understand your issue yet... can you please mention more details about your problem?

Any project or code you can share so the problem can be reproduced?

Thanks,
Jorge

from unityosc.

heinzehavinga avatar heinzehavinga commented on July 16, 2024

I seem to have the same problem, even when I shut down my server (I'm sending from Processing) Unity keep telling me the same message over and over. Actually on closer inspection it seems that Unity only gets the first message and ignores any other message that's coming in.

For the code I am using the test code placed on an empty object in de gameworld.

If there is anything to show this behaviour I would be glad to provide anything.

from unityosc.

jorgegarcia avatar jorgegarcia commented on July 16, 2024

It would help if you share a project reproducing the problem please. In any case, you may also want to check whether the timestamp in each of the packets change (so you know that you have received a new packet). Also, have a look into the test here if you haven't done it already:

https://github.com/jorgegarcia/UnityOSC/blob/master/tests/oscControl.cs

from unityosc.

yourule avatar yourule commented on July 16, 2024

Hi, I encountered the same problem. Data is received by unity but only the first value is used in update. I've created a project for reproduction which you can download here:

http://www.yourule.nl/unityOSC/IncommingOSCtest.zip

Noteworthy:
In your oscControl.cs class the count of the items (item.Value.log.Count) never gets bigger than 1.

Maybe it's got something to do with this warning which pops up after pressing stop. (but not always):
Assets/OSCBundle.cs(89,41): warning CS0108: UnityOSC.OSCBundle.Unpack(byte[], ref int, int)' hides inherited memberUnityOSC.OSCPacket.Unpack(byte[], ref int, int)'. Use the new keyword if hiding was intended

I'm running Unity 4.5.5 (but also tried 4.3.0) on MacOSX 10.9.5
Same problem on Unity 4.5.3 on Windows 8.1

I also made a very small sending app for testing on Mac and PC using MaxMSP for debugging purposes
http://www.yourule.nl/unityOSC/toUnityOSC-apps.zip

BTW, i've been using the sending part for a while now, and I must say I'm impressed by your work!

from unityosc.

sunekastbjerg avatar sunekastbjerg commented on July 16, 2024

I encounter the same problem on Unity 4.6 Beta 20. Sending to OF works fine, but it does not update. It only updates when i start and stop the unity editor.

from unityosc.

yourule avatar yourule commented on July 16, 2024

Update:
If I Debug.Log(_servers[pair.Key].server.LastReceivedPacket.Data[0]); in public void UpdateLogs() I can see the values updating. The problem seems to be the timestamp always being 0, so the data is there but the writing in the dictionary fails due to the missing time stamp?

from unityosc.

yourule avatar yourule commented on July 16, 2024

Hack to make UpdateLogs() in OSCHandler.cs work:

public void UpdateLogs()
{
foreach(KeyValuePair<string,ServerLog> pair in _servers)
{

        if(_servers[pair.Key].server.LastReceivedPacket != null)
        {
            //Initialization for the first packet received
            if(_servers[pair.Key].log.Count == 0)
            {   
                _servers[pair.Key].packets.Add(_servers[pair.Key].server.LastReceivedPacket);

                _servers[pair.Key].log.Add(String.Concat(DateTime.UtcNow.ToString(), ".",
                                                         FormatMilliseconds(DateTime.Now.Millisecond)," : ",
                                                         _servers[pair.Key].server.LastReceivedPacket.Address," ",
                                                         DataToString(_servers[pair.Key].server.LastReceivedPacket.Data)));
                break;
            }

            //if(_servers[pair.Key].server.LastReceivedPacket.TimeStamp
            //   != _servers[pair.Key].packets[_servers[pair.Key].packets.Count - 1].TimeStamp)
            //{ 



                if(_servers[pair.Key].log.Count > _loglength - 1)
                {
                    _servers[pair.Key].log.RemoveAt(0);
                    _servers[pair.Key].packets.RemoveAt(0);
                }

                _servers[pair.Key].packets.Add(_servers[pair.Key].server.LastReceivedPacket);

                _servers[pair.Key].log.Add(String.Concat(DateTime.UtcNow.ToString(), ".",
                                                         FormatMilliseconds(DateTime.Now.Millisecond)," : ",
                                                         _servers[pair.Key].server.LastReceivedPacket.Address," ",
                                                         DataToString(_servers[pair.Key].server.LastReceivedPacket.Data)));
            //}
        }
    }
}

from unityosc.

jorgegarcia avatar jorgegarcia commented on July 16, 2024

Apologies for the delay on this reply.

@yourule Thanks for pointing out a fix. If you think it's appropriate (and you well-tested it) please fork and do a pull request. Then I can review/merge the changes and other users of UnityOSC can benefit from them.

from unityosc.

yourule avatar yourule commented on July 16, 2024

Thank you for your reply.
For now it's a quick fix. This method resolves another problem where different messages which arrive on the same time where not passed through. I'll do some thoroughly testing and will keep you updated!

from unityosc.

Gamgie avatar Gamgie commented on July 16, 2024

Hi everyone !

I got the same problem. The fix of yourule works.

I did it another way (but I'm not sure this is better :p)
Just add a variable in OSCServer that is incremented each time the server receives a message. I store this as a timestamp in the OSCPacket. It ensures you have a growing timestamp for each message on each server.

In my unity app, I check an internal timestamp compared with the UnityOsc packet timestamp.

The limitation I see is that you have to store a timestamp reference for each of your OSCServer. Which is annoying.

Hope this will be fixed in the best manner found :)

from unityosc.

re-sounding avatar re-sounding commented on July 16, 2024

I can confirm this issue both on Unity 4.6 and Unity 5 ( I've used it without any issues in older versions ). Timestamps for all packets are "0".

@jorgegarcia I've skimmed through the code and couldn't really pick out how timestamps are handled. Any insight would be very helpful.

from unityosc.

jorgegarcia avatar jorgegarcia commented on July 16, 2024

Hi @ntkeep and the rest,

Apologies for the slow response!

I've just commited the change 3dba77c for generating a timestamp using the machine time when it's zero. This would happen when receiving OSC packets from applications that don't send timestamps, or if the data is not deserialised properly.

I've been doing a bit of testing today and all seems OK. Please pull and check whether this fixes the issues mentioned above. As always, feel free to create a new issue if you have further problems with UnityOSC :)

Thanks,
Jorge

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.