labstreaminglayer / LSL4Unity

A integration approach of the LabStreamingLayer Framework for Unity3D
Other
85 stars 39 forks source link

Unity doesn't see Marker stream from Enobio 32 #54

Closed amemov closed 1 year ago

amemov commented 1 year ago

Hello, I'm using OpenVIBE 3.5.0 to run some scenarios and to stream signals and markers to the Unity. I have zero issues with signals, however, when I try to get Markers from openVIBE, unity initializes StreamInlet MotorImagery_Incoming to null. I did make sure that the Markers channel name is the one I need, but I still get errors.

1Screenshot 2023-07-27 201615 Screenshot 2023-07-27 194743 Screenshot 2023-07-27 194835

cboulay commented 1 year ago

I'm afraid I don't understand the issue. It appears as though all streams are initialized to null and it's the connection listener that then sets the inlet when the resolver finds it. If MotorImagery_Incoming continues to be null even well after the application has started then I guess that means that the resolver can't find it.

Are you sure the stream Type is "Markers" (and not "Marker" or "Events" etc.)?

Do you ever see the Debug.Log for "Motor Imagery stream connected"?

A few other notes:

dmedine commented 1 year ago

You are redeclaring MotorImagery_Incoming inside the while loop with a using statement. This object is then being destroyed as soon as it goes out of scope and the global MotorImagery_Incoming object remains null. Yielding null on each pass which is definitely not desirable. In C# yield and IEnumerator are used for writing iterators---typically so that you can use methods or objects in foreach statements. These methods are not being used in that way.

In fact, I myself cannot get this snippet to compile under .NET 6. First of all, IEnumerator needs to be templated to a type, second of all, it is illegal to redeclare a variable name.

That is to say, this is not an issue with LSL, the client code is not working properly.

jfrey-xx commented 1 year ago

Hi, just a quick reminder that OpenViBE has two boxes to export LSL, the default one where a dedicated Markers stream is created (http://openvibe.inria.fr/documentation/3.5.0/Doc_BoxAlgorithm_LSLExport.html) and another one (Gipsa http://openvibe.inria.fr/documentation/3.5.0/Doc_BoxAlgorithm_LSLExportGipsa.html ) where the markers are in fact included as float values in a supplementary channel of the signal stream (but here you can choose both stream name and types). If even after correcting the code as described above you cannot find the markers stream, maybe you used Gipsa? My two cents of lurking around :upside_down_face: