Unity Integration Best Practices
This section covers some best practices for working with the Genvid Unity prefab.
Use a root scene for the Genvid prefab
The root scene ensures that the Genvid prefab is present only once in your application. This keeps the Genvid prefab alive between scenes, so you don’t need to place it on any other scene. When there are several instances of the Genvid prefab, it causes various issues with the stream.
Build your application to use DirectX 11
The Genvid prefab video-capture only works with DirectX 11, so you need to use
it while running your application. You can force your game to use DirectX 11 by
running it with the option -force-d3d11
, but it’s not normally needed.
Use the correct type of video capture to show or hide the HUD
The HUD displays when you use Automatic
video capture. The HUD won’t be
visible if you use Texture
video capture.
Build your application only when the Genvid stack is stopped
When the Genvid stack is running, we use the Genvid.dll to run services. When you perform a build while the stack is running, there is no guarantee that the files will be copied properly. Make sure to stop all the jobs before performing a build with your application either from the Cluster-UI monitor screen or the Genvid Cluster-api window inside Unity.
Recommended settings
- For the best streaming experience, we recommend using the following settings:
Deactivate the vsync:
Go to Quality Settings.
Search for
V Sync Count
and set it toDon't Sync
.
In the
AudioManager
, set the audioDSP Buffer Size
toGood latency
.Set your application FPS to 30 or 60.
To prevent further audio conversion, processing, and copying, use the
Audio Format
F32LE
.To limit calls to the garbage collector, which stalls the thread, keep new allocations to a minimum.
To benefit from the latest optimizations, use the latest C# SDK Wrapper.
Select your
Audio Mode
according to where you are running your setup:In a local environment,
unity
avoids loopback capture and is well designed for development mode.On the cloud,
Wasapi
is the best way to capture audio in production mode since it provides the best latency and stability.