jorgegarcia / unityosc Goto Github PK
View Code? Open in Web Editor NEWOpen Sound Control (OSC) C# classes interface for the Unity3d game engine
Open Sound Control (OSC) C# classes interface for the Unity3d game engine
Hello, I recieve high rate osc message(120 messages / per second, or higher) with big latency.
Maybe problem is here.
private void ReceivePool()
{
while( true )
{
Receive();
Thread.Sleep(10); // maybe problem here
}
}
I suggest sleeptime parameterization.
Apology for the brevity but it was just a simple test from the example files.
When receiving transmission from the iOS it works just fine but from Android it doesn't work.
See this helpful doc on xamarin.com that discusses the issues with generics and dynamic types w/ Mono on iOS: http://developer.xamarin.com/guides/ios/advanced_topics/limitations/
Any timeline for getting osc bundles happening? I'd really like to connect open frameworks to unity via osc
i am using unityosc together with faceosc. i have included this for testing in the update loop:
void Update () {
OSCHandler.Instance.UpdateLogs();
foreach(String entry in OSCHandler.Instance.Servers["FaceOSC"].log) {
Debug.Log(entry);
}
}
the server is running, i can see that both with netstat and in the oschelper window.
but i never get any data. there are no packets coming in. if i do the same setup with osculator instead of unityosc i can see all the data coming in and also with netcat i could dump the data coming in from faceosc on the correct port.
am i missing something?
Upon opening TestScene.unity
in the assets folder of the tests/touchosc_integration
Unity project and copying the contents of src
into the Assets folder of the project, I see the following error in the console:
Assets/OSCHandler.cs(96,23): error CS0619: `UnityEngine.Network' is obsolete: `The legacy networking system has been removed in Unity 2018.2. Use Unity Multiplayer and NetworkIdentity instead.'
Hi,
you're lib is really good, but the need of the OSCHelper window being opened to get it working makes it absolutely not functionnal.
In my setup, when i click play, nothing is received until the osc helper window is opened, no matter where.
When i export the application and launch it, nothing is received (i guess this is the same problem)
Is there a way to avoid this behaviour i've not seen ?
Thanks
Ben
Sorry this isn't an issue i just don't find a way to send múltiple data on a single OSCmessage.
I need to send Time.time, and XYZ coordenates on the same líne to ensure no lost messages fuckups.
Thanks
Hi,
I send a lot of OSC packets to UnityOSC. And the current packet was more and more in the past.
So I looked a bit in the code and I found that every 10ms a new packet is received. So I guess that's the limit for receiving packets. Next thing I noticed is that _lastReceivedPacket
is just overridden in the Receive() function. So when the logs are updated in the UpdateLogs()
function, it takes the last one but this happens maybe every 16ms (60fps) if you call I call it in my Update()
function, so there could be packet loss right?
So I thought it would be maybe be a good idea to give the developers also an option to have access to the PacketReceivedEvent
. Just to try that out I replaced the void OnPacketReceived(OSCServer server, OSCPacket packet)
with
public delegate void OSCPacketReceived(OSCServer server, OSCPacket packet);
public static event OSCPacketReceived OnOSCPacketReceived;
void OnPacketReceived(OSCServer server, OSCPacket packet)
{
if(OnOSCPacketReceived != null){
OnOSCPacketReceived(server, packet);
}
}
Then I could do something like this in my script:
OSCHandler.OnOSCPacketReceived += OnPacketReceived;
I then figured out that this runs in another thread which makes sense, so I can't directly change gameobjects. So there needs some kind of copying step before, so I looked how this is solved in UnityOSC and the _lastReceivedPacket
is just written and read without any locking. Couldn't there be any problems with writing and reading at the same here?
Hi,
I've been trying for the last few days to use the SimpleReceiverScript to receive and compare values from the OpenVibe. I have no problems getting and even seeing the values in the console, but how do I construct an If statement to do something supposing say the incoming value is lower than something specified by me?
Unfortunately, I am fairly new to coding, and am unable to piece together what is required.
Your help is appreciated.
Thanks.
Hi, I get this issue every time I run my game in Unity
Debug.LogError(string.Format("Can't send OSC messages to {0}. Client doesn't exist.", clientId));
Any help?
Thank you
I'm not sure I understand the design of this library. Every other OSC lib I've used gets rid of old messages as you read them out. Even when I clear a ServerLog.log, the messages somehow come back.
I can't check to see if a OSCPacket is new because the TimeStamp on them is always 0.
Hi, everything was ok until at some point, I've built the game and then I started getting the "Client doesn't exist" error. I am using
OSCHandler.Instance.Init();
OSCHandler.Instance.CreateClient("myClient", IPAddress.Parse(outIP), outPort);
inside the Start function of a OSCController class (very similar to OscControl example provided) and I haven't changed anything specific about it. I wrapped the SendMessageToClient in a new method
public void sendOsc(int val)
{
OSCHandler.Instance.SendMessageToClient("myClient", "/1/fader1", val);
}
This is the full error
Can't send OSC messages to myClient. Client doesn't exist.
UnityEngine.Debug:LogError(Object)
OSCHandler:SendMessageToClient(String, String, List`1) (at Assets/OSCHandler.cs:287)
OSCHandler:SendMessageToClient(String, String, Int32) (at Assets/OSCHandler.cs:238)
OSCController:sendOsc(Int32) (at Assets/OSCController.cs:85)
ScreenR:Start() (at Assets/ScreenR.cs:34)
suggestions about where should I look? Thanks
The plugin implemented in my own project works perfectly fine, connects and sends data out (in my case to Pure Data) without any problem whatsoever.
The only issue is that in test mode I noticed that the OSCHandler GameObjects start piling up without never being destroyed. In fact, even diving in the scripts there is nothing that destroys the GameObjects.
Is it a known issue, or am I implementing it in the wrong way?
I'm using Unity 2017.1.1 with the latest version of UnityOSC from github. The profiler reports 1,4ms execution time and 72KB GC allocation on my script, which I can trace back to the OSCHandler.Instance.SendMessageToClient() call. The function is being called three times per frame as I'm sending three parameter values out via OSC. See the screenshot for profiler details:
Unfortunately, having two instances of the script running in a scene doubles both, execution time and GC alloc, so this doesn't scale well. What can be done about this? Is this the expected behaviour or am I doing something wrong?
System is Win10x64 with an i5-3380M.
Hi Jorge!
Thank you for your work, it helped me a lot understanding OSC.
I have one question I cannot find a solution over the Internet. I haven't seen explicitly that it is not possible sending extended ASCII characters in strings.
Nevertheless, I can't do that. Whenever I try to, I get the "?" character.
I know it's maybe not related to your plugin specifically, but any help would be much appreciated since I can't find any info even in the OSC web.
¡Muchas gracias!
Hi Jorge,
first, great work! Helped me a lot. I came across one strange issue. Receiving from another device (in the local network) does not work properly. Wireshark and another application (vvvv) I was testing with showed the UDP/OSC packages correctly but Unity did not react at all. Forwarding the received packets (again with vvvv) to another port works in Unity, so is there a difference in receiving remote and local packets?
I know that this does not necessarily need to have do with the UnityOSC package itself but perhaps you also experienced such an issue? Or is actually the port number 5555 reserved for something else in Unity?
Thank you so much!
Hello,
Thanks for this library. I'm facing an issue. Currently I'm working in an app that reads data from Emotiv Epoc, I'm using this this snippet from previous examples:
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
}
}
But I'm getting:
SERVER: AndroidPhone ADDRESS: #bundle VALUE 0: UnityOSC.OSCMessage
So, I'm getting the type, not the data received. I tried unpacking the message with with no luck
I'm using Unity 5.0 and I don't know if this is the problem.
Thanks.
I'm trying to build UWP Application using UnityOSC to run on the Hololens.
However, I'm getting the error:
The type or namespace name 'UdpClient' could not be found (are you missing a using directive or an assembly reference?)
According to HoloLens Developer forum.
UdpClient has also been renamed to DatagramSocket.
see in under the forum
https://forums.hololens.com/discussion/604/udpclient-could-not-be-found
http://forums.hololens.com/discussion/578/hololens-udp-server
if I 'll be able have a time .fix this issue for me.
Helo there jorge,
firstly i would like to thank you for your plugin in. its really great.
however, i have encountered, probably, a dictionary-memory problem. I am sending OSC to unity from a program in processing, and what I want to do, is sending data every some milliseconds. The problem i have at the moment is that unity stops receiving after some point. I am currently sending 45 floats each time, and it stops after 25 receptions. My intelligent guess is that the dictionary gets filled up.
So, because I am not very familiar with the dictionary structure I would like to ask you how I could empty the dictionary received values.
I've tried some things, but all I can do is delete the server completely ;p
thank you in advance
c.
Hi Jorge, this is an amazing plugin! I'm trying to send MIDI OVer Wifi Using OSC, rom an application in Unity to Resolume Arena 6.
I didn't have any problem sending OSC address to Resolume, but now I'm wondering how to send it to resolume using TouchOSC Bridge, I test TouchOSC Bridge using the TouchOSC app on android, and it sends MIDI, now I'm wondeering how to it, using your library, it will really helpful for me, can you give me an insight? Thank you so much.
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
I have tried to receive multibyte character, I can't receive it, and it displays "???".
For example, I send "こんにちわ", it is Japanese Character, it displays "???" in UnityOSC.
Is there a good way to fix it?
Hello there, could you please help me? Maybe it's just simple thing to do. But I have no idea why is this missing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.