地域を選んでください
Australia
Österreich
België
Canada
Canada - Français
中国
Česká republika
Denmark
Deutschland
France
HongKong
Iceland
Ireland
Italia
日本
Korea
Latvija
Lietuva
Lëtzebuerg
Malta
المملكة العربية السعودية (Arabic)
Nederland
New Zealand
Norge
Polska
Portugal
Russia
Saudi Arabia
Southeast Asia
España
Suisse
Suomi
Sverige
台灣
Ukraine
United Kingdom
United States
地域を選んでください
België
Česká republika
Denmark
Iceland
Ireland
Italia
Latvija
Lietuva
Lëtzebuerg
Malta
Nederland
Norge
Polska
Portugal
España
Suisse
Suomi
Sverige

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)