Search Unity

Bug Why is there XR plugin management if it's added anyway to all builds..

Discussion in 'VR' started by Jelmer123, Nov 23, 2020.

  1. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    243
    I'm building a project to both VR and WebGL.
    Obviously I don't want the Oculus SDK in my WebGL build, lucikly -i thought- the XR plugin management fixes this.
    But the Oculus SDK is included in any target despite those settings. So what does the XR plugin management really do? And why is it so hard to create cross platform solutions with Unity. You would expect to be able to just exclude certain things from certain targets in an easy way???

    Cloud build errors for WebGL:

    [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll
    [Unity] Assets/Oculus/Avatar/Scripts/OvrAvatar.cs(985,28): error CS0103: The name 'Microphone' does not exist in the current context
    [Unity] Assets/Oculus/Avatar/Scripts/OvrAvatar.cs(1008,9): error CS0103: The name 'Microphone' does not exist in the current context
    [Unity] Assets/Oculus/Avatar/Scripts/OvrAvatar.cs(1015,26): error CS0103: The name 'Microphone' does not exist in the current context
    [Unity] Assets/Oculus/Avatar/Scripts/OvrAvatar.cs(1021,9): error CS0103: The name 'Microphone' does not exist in the current context
    [Unity] Assets/Oculus/LipSync/Scripts/OVRLipSyncMicInput.cs(117,13): error CS0103: The name 'Microphone' does not exist in the current context
    [Unity] Assets/Oculus/LipSync/Scripts/OVRLipSyncMicInput.cs(121,26): error CS0103: The name 'Microphone' does not exist in the current context
    [Unity] Assets/Oculus/LipSync/Scripts/OVRLipSyncMicInput.cs(135,17): error CS0103: The name 'Microphone' does not exist in the current context
    [Unity] Assets/Oculus/LipSync/Scripts/OVRLipSyncMicInput.cs(161,22): error CS0103: The name 'Microphone' does not exist in the current context
    Truncated to 10 lines.
     
  2. wajiharehman12

    wajiharehman12

    Joined:
    Apr 24, 2021
    Posts:
    1
    Any luck with this?
     
  3. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    Is the oculus sdk mentioned in any script used in your scene(s)?

    Also, the Oculus Integration package is not a part of the XR Management. The Oculus package is and wont cause issues like this
     
  4. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    243
    Yeah XR Management doesn't do much.
    The Oculus scripts are included to any platform so the key was to handle this manually. I ended up creating assemblies for the whole oculus SDK, and excluding them from WebGL. It is quite some linking and clicking, but in 15 mins you should be good to go.
    In short: in the root folder of the oculus SDK, you click right mouse and create an assembly file. However, you have to make exceptions (e.g. create assembly files) for each Editor folder down the hierarchy, and then link those assemblies back to the main assemblies to solve reference errors.
     
  5. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    Again. what do you mean with the oculus SDK?
    If you mean the Oculus Integration package (https://assetstore.unity.com/packages/tools/integration/oculus-integration-82022), this is not a part of Unity/XR Management and thus will not be changed per build platform.
    If this happens from the Unity Oculus package (just called Oculus and installed by clicking the checkmark in XR management), this should not happen and you should open a bug report
     
  6. Mateofloyd

    Mateofloyd

    Joined:
    Sep 6, 2019
    Posts:
    3
    Can you explaine me how you did these please? Im having a bad time with that problem and Im kind of new on this
     
  7. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    Did you ever solve this? I also want to produce a webgl build as an alternative to my VR build but the Oculus SDK does not use ifdefs to mask out the usage of the Microphone API which then produces compile errors.
     
  8. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    243
    I did solve it, I described it above. So the first step is to go into the Oculus Plugin folder in Assets. Create right: Create: Assembly Definition. There you can select for what platforms that assembly will be included or excluded. So exclude for WebGL. But there will be compilation errors, so you have to make new assemblies in certain sub folders with exclusion..
     
    DevDunk and ImpossibleRobert like this.