Please Select Your Location

Thailand
Australia
Österreich
België
Canada
Canada - Français
中国
Česká republika
Denmark
Deutschland
France
HongKong
Iceland
India
Ireland
Italia
日本
Korea
Latvija
Lietuva
Lëtzebuerg
Malaysia
Malta
Mexico
Nederland
New Zealand
Norge
Polska
Portugal
Russia
Saudi Arabia
Singapore
Southeast Asia
España
Suisse
Suomi
Sverige
台灣
Ukraine
United Kingdom
United States
Việt Nam
المملكة العربية السعودية (Arabic)

Using the Unity Main Thread Dispatcher script

The VIVEPORT SDK APIs use callback functions to return their execution results. The various callback functions are called from threads other than the main thread. However, Unity requires function calls or actions (such as UI manipulation) to come from the main thread.

To solve this problem, use the Unity Main Thread Dispatcher script with your VR content to dispatch callback functions to the main thread. Here’s how:

  1. Create an empty GameObject in your scene and name it as MainThreadDispatcher .
  2. You’ll find the script MainThreadDispatcher.cs under Assets/Viveport/Scripts/ in the VIVEPORT SDK. Attach this script to the GameObject you created.
  3. Add the following at the beginning of your script:
    using Viveport
  1. Use the following convention to execute an action from the main thread:
    MainThreadDispatcher.Instance().Enqueue(YourAction)