Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
751 stars 188 forks source link

[BUG] OpenGL verification fails with DeviceSimulator package #511

Open stef-t opened 3 years ago

stef-t commented 3 years ago

Hey,

I've been using this package and the DeviceSimulator package in the same Unity project. I noticed that the OpenGL verification that is triggered during WebRTC.Initialize fails when both the DeviceSimulator and this WebRTC package are part of the same Unity project.

To Reproduce Steps to reproduce the behavior:

  1. Create a new Unity project
  2. Add this WebRTC package
  3. Add the DeviceSimulator package
  4. In the Game View open the dropdown and select Simulation
  5. In the Simulation View choose an Android device like the Google Pixel 2
  6. Switch to the Android platform (Build Settings > select Android > switch platform)
  7. Go to ProjectSettings > Player > Android tab > Graphics API > remove Vulkan (only OpenGLES3 should be left in the array of supported Graphics APIs)
  8. Import the WebRTC samples (Package Manager > WebRTC > import samples)
  9. Open the PeerConnection sample (any sample would do)
  10. Switch into PlayMode

Expected behavior The sample runs as expected without error.

Current behaviour The sample aborts with error:

Not Support OpenGL API on ...

Environment:

Additional context

What happens is that the DeviceSimulator simulates SystemInfo! Now when, e.g., the Google Pixel 2 is selected, SystemInfo.graphicsDeviceType (see WebRTC.Initialize) will return the simulated graphicsDeviceType of the selected simulated device instead of the graphicsDeviceType of, e.g. in my case, my MacBook.

Note that is the expected behaviour of the DeviceSimulator. It's just that the OpenGL verification fails to take into account the DeviceSimulator in the Editor.

As a band aid fix one can turn off the simulation of SystemInfo (ProjectSettings > DeviceSimulator > "Simulate SystemInfoClass"). For projects that actively use the DeviceSimulator this might break some stuff, if they rely on the simulation of SystemInfo in the Editor.

karasusan commented 3 years ago

@stef-t Thanks for your report! I have never known the behavior of the Device Simulator with this package. We will check it and fix the verification of the graphics API and write some note into the package docs.

kannan-xiao4 commented 2 years ago

memo: WRS-138