Trying to load wrong namespace when building for WSA

I have two DLLs with their PDB files loaded into my Unity project. One targets the editor in the “Select platforms for plugin” inspector and is in the folder Assets/Plugins. The other targets WSAPlayer, has UWP selected for the SDK and DotNet for the scripting backend. It is in the folder Assets/Plugins/WSA.

When I attempt to build for Windows Store (SDK: Universal 10, Target device: PC, UWP Build Type: XAML, UWP SDK: Latest installed, and Build and run on: Local Machine) I get the following errors:

Assets\CubeScript.cs(16,48): error CS0246: The type or namespace name ‘Win32HidDevice’ could not be found (are you missing a using directive or an assembly reference?)

Error building Player because scripts had compiler errors

I would not expect UWP to be able to load Win32HidDevice, nor does my UWP DLL use it, so it must be coming from the other DLL. The app works fine debugging in the editor, and if I also check “Standalone” on the first DLL then I can build and run a standalone app.

What settings do I need to get Unity to ignore the Win32 DLL and use the UWP one when building for WSA?

I do not think it is the script itself, but for completeness here it is:

using UnityEngine;
using Zanzibar;

public class OrbScript : MonoBehaviour
{
    public Mat mat;

    void Start ()
    {
        MatManager.Instance.MatConnected += MatConnected;
        MatManager.Instance.MatDisconnected += MatDisconnected;
        MatManager.Instance.Initialize(Communication.AllSupported);
    }

    private void MatConnected(Mat mat)
    {
        Debug.LogFormat("Mat {0}", mat.UniqueName);
        this.mat = mat;
    }

    private void MatDisconnected(Mat mat)
    {
        this.mat = null;
    }

    void Update ()
    {
        if (mat == null)
        {
            GetComponent<Renderer>().material.color = Color.black;
        }
	    else if (mat.TaggedObjects.Count > 0)
        {
            GetComponent<Renderer>().material.color = Color.green;
        }
        else if (mat.Touches.Count > 0)
        {
            GetComponent<Renderer>().material.color = Color.magenta;
        }
        else
        {
            GetComponent<Renderer>().material.color = Color.white;
        }
    }
}

@Tautvydas-Zilys spotted my problem over on the forums here. I’d been looking in the wrong script, doh! CubeScript.cs contained this line:

var currentMat = orb.mat.Device as Win32HidDevice;

which I needed to replace with these lines:

#if UNITY_STANDALONE_WIN || UNITY_EDITOR
    var currentMat = orb.mat.Device as Win32HidDevice;
#elif UNITY_WSA_10_0
    var currentMat = orb.mat.Device as UwpDevice;
#endif