We’re using unity for psychophysical experiments and we need to know an exact timing of things occurring in the game. The preferred solution is to communicate with an LPT port connected to the experimental equipment and send a message every time a specific event occurs in the game or a key is pressed.
My question is whether it is possible to send these triggers to the parallel port from within Unity?
Since this will be used to synchronize between the Unity and the data (EEG) collected from the subject, we need to make sure that these messages to the LPT are really sent with a precise timing. We can tolerate a delay in the trigger sending if it is a constant delay, but the noise in this delay shouldn’t be much more than ~30 milliseconds.
This questions was actually already asked in the past @Agoston Torok, @Bunny83, @aldonaletto, but it was 5 years ago and I understand these features in Unity changed meanwhile. See the post here:
@Socapex is right, you’ll need to communicate with the port using a c# script and inpout32.dll or similar (depending on your OS). From the latency point of view: we used a light diode to check for sync in our setup (attached it to the screen and check the latency between trigger and diode signal), I suggest you to do the same. Note that FPS may change during a game, your screen has a refresh rate too, and the physics in the game is not tied to refresh rate. Also, note that delay is not much of a problem, uncertainty on the other hand is. If you have other questions pls don’t hesitate to contact firstname.lastname@example.org