Comments (5)
Hi, my understanding is that you can't send the first message in the Start() function so you will need to add it to your Update function, yes.
from unityosc.
ok I think I've found the issue (but for some reason it wasn't an issue before?)
Basically in my main class I was sending the first osc message (through my custom sendOsc) in the Start() method. Now I moved it to the update method and it works, although it doesn't look the best way of doing this.
Here's the code
public class ScreenR : MonoBehaviour
{
public KinectController kinect;
public OSCController oscController;
private GameObject shape;
public float waitTime = 10f;
private float timer;
public string outIP = "127.0.0.1";
public int outPort = 9999;
// current shape (1 cube, 2 sphere, 3 capsule)
private int index;
public int Index
{
get { return index; }
set { index = value; }
}
void Start()
{
//initial index
index = 1;
// initial shape
shape = GameObject.CreatePrimitive(PrimitiveType.Cube);
//send first message
oscController.SendOsc(index); //THIS DOES NOT WORK (THROWS ERROR)
GetComponent<Renderer>().material.color = Color.black;
}
private bool b = true;
void Update()
{
//THIS WORKS
if (b)
{
oscController.SendOsc(index);
b = false;
}
//..other stuff
}
from unityosc.
In order to make the scripts work, you should first initialise the client. Once that's done, you can start sending messages (in the Update() function for instance, as you did).
Thanks,
Jorge
from unityosc.
Hi, ok, so there's no way to send a message from the Start? Basically I need to send a first message which is a bit different than the others (and it starts the whole communication). Using a bool as I did seemed a bit clumsy :)
from unityosc.
ok thanks!
from unityosc.
Related Issues (20)
- Not working on Android HOT 4
- Timing Problem/Question (Packet loss?) HOT 1
- Too big latency when Recieving high rate OSC message. HOT 2
- Doesn't work on UWP (HoloLens) HOT 3
- Client Doesn't Exist HOT 1
- Get an OscBundle HOT 6
- Performance issues HOT 1
- OSCHandler GameObjects continue instantiating without being destroyed HOT 6
- Send / Receive extended ASCII strings HOT 1
- Can't receive multibyte characters? HOT 1
- How to "message.add"? HOT 2
- Comparing OSC Message HOT 1
- Receiving from external IP HOT 1
- Assets/OSCHandler.cs(96,23): error CS0619: UnityEngine.Network' is obsolete HOT 1
- MIDI HOT 1
- Assets/Editor/OSCHelper.cs(41,29): error CS0246: The type or namespace name `ClientLog' could not be found. Are you missing an assembly reference? HOT 1
- impossible to tell if you have received a new message HOT 12
- Can't debug Data from Log. HOT 3
- value.GetType() use causes AOT compile issues on iOS HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unityosc.