Facepunch/Facepunch.Steamworks

Build fails for WebGL: The type 'SteamClient' exists in both Win32 and Win64

jan opened this issue · 3 comments

jan commented

Hey Garry, first: thanks for your work on Facepunch.

I am not sure if it should work for WebGL, but for me it does not:

Describe the bug
A clear and concise description of what the bug is.

Building for WebGL fails with errors like:

The type 'SteamClient' exists in both 'Facepunch.Steamworks.Win32, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Facepunch.Steamworks.Win64, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

(And same for each other Facepunch class I use.)

To Reproduce
Steps to reproduce the behavior:

  1. Create 3D (URP) Unity project
  2. Extract Facepunch.Steamworks.2.3.2.zip and copy files contained in its Unity folder into Assets/Plugins/Facepunch.Steamworks
  3. Create Empty Object Face Test and assign a new script FaceTest (code see below).
  4. Open Build Settings, switch to WebGL, hit Build & Run.
  5. See error.

Calling Code

using UnityEngine;

public class FaceTest : MonoBehaviour
{
    private void Awake()
    {
        try
        {
            Steamworks.SteamClient.Init(252490);
        }
        catch (System.Exception e)
        {
            Debug.LogError(e);
        }
    }
}

Expected behavior
I'd expect it to build successfully.

Desktop (please complete the following information):

  • OS: MaxOS 12.5
  • Unity: 2022.3.6f1

Additional context
Add any other context about the problem here.

I'm having the exactly described issue as well. Unity 2021.3.23f1

I'm also interested in basic webgl support if possible.

You can get around the duplicate library build error above simply by deleting the win32 libraries if you are not worried about that legacy support? But when the webgl window opens it cannot find the correct dll to use at runtime - since likely none are checked for webgl in the import setting meta files. I'm not sure what the right answer is - has anybody gotten the SteamClient.Init to work in webgl?

Perhaps another approach is to call steamworks web apis directly and use openid login if you just need the steam id and friends list and a few simple calls?
https://partner.steamgames.com/doc/webapi_overview