I was able to solve how to run code on the main unity thread. However, I have another question and would appreciate it if you could answer.
First of all, this is what I have
1. I've game objects created already in my unity scene.
2. I've real-time transform (position and orientation) data coming from a networking library for those game objects (>100 Hz).
What would be the best way to apply those transform (position and orientation) to the game objects?
I would think of two ways to do it
1. Unity update function (Store real-time transform data into Concurrent Queue and use them inside the update function) - Don't know how to approach this at the moment
2. Raise a signal which executes a command as soon as real-time data arrives and it will update game objects onto the main unity thread. - In this approach, I am updating transforms much faster than unity update function 60Hz.
If there is any other way to update the game object transform, I would be happy to know.