question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't compile game with ambiguous reference message

See original GitHub issue

Describe the bug Assets\Scripts\Game\Steam.cs(12,17): error CS0433: The type 'SteamClient' exists in both 'Facepunch.Steamworks.Posix, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Facepunch.Steamworks.Win32, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

Can’t compile game with simple initialization script with Facepunch.Steamworks because of this. Tried to remove Posix and Win32 assemblies with no luck (these are coming back automagically). Tried assigning them aliases - same problem.

To Reproduce Steps to reproduce the behavior:

  1. You need to have empty Unity project 😉
  2. Download v2.3.2 release zip from github and do exactly what is on the https://wiki.facepunch.com/steamworks/Installing_For_Unity
  3. Unpack zip and Unity folder contents to Assets/Plugins/Facepunch.Steamworks
  4. Create simple Steam.cs script with:
using UnityEngine;

namespace Game
{
    public class Steam : MonoBehaviour
    {
        // Start is called before the first frame update
        void Start()
        {
            try
            {
                Steamworks.SteamClient.Init(480); // FIXME: this is test steam app id
            }
            catch (System.Exception e)
            {
                // Something went wrong - it's one of these:
                //
                //     Steam is closed?
                //     Can't find steam_api dll?
                //     Don't have permission to play app?
                //
                Debug.Log(e.Message);
            }
        }
    }
}
  1. Attach to any empty component on the scene in Unity
  2. Try to compile

Calling Code

Code is pasted above.

Got this in the code: image

Expected behavior Should properly compile and allow to run the game in editor/built game no matter the platform.

Desktop (please complete the following information):

  • OS: Windows 10 latest build
  • Unity: 2020.1.0f1
  • IDE: Rider: 2020.1.3 or VS 16.5.5 (does it matter at all ?)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
qmarsalacommented, Mar 17, 2022

Ran into this today and wanted to share how I fixed the issue.

The release zip does seem to be missing the .meta files as others have pointed out. To get around this, I downloaded and extracted the unity folder into my assets as the docs say to do. At this point, my unity project has all the Facepunch code, and autogenerated .meta files that are incorrect. To fix the autogenerated .meta files, I followed these steps from the “building from main” section of the docs. Everything is now working as expected.

https://wiki.facepunch.com/steamworks/#howtobuildfrommasterbranch

Facepunch.Steamworks.Posix.dll:

Any Platform: Unchecked
Include Platforms: Editor, Standalone
Platform Settings:
CPU: Any
OS: OSX
Switch tabs:
Windows: all unchecked
Linux and OSX: all checked


Facepunch.Steamworks.Win32.dll:

Any Platform: Checked
Include Platforms: Both Unchecked
Platform Settings:
CPU: x86
OS: Windows
Switch tabs:
Windows: check x86
everything else: Unchecked


Facepunch.Steamworks.Win64.dll:

Any Platform: Checked
Include Platforms: Both Unchecked
Platform Settings:
CPU: x86_64
OS: Windows
Switch tabs:
Windows: check x86_64
Linux and OSX: Unchecked
1reaction
nCorecommented, Aug 1, 2020

That’s fine, but the docs clearly states to unpack everything into plugins folder. This is how I understood that.

image

As a beginner in Unity I thought it will automagically handle all the stuff in there.

Maybe you should change the information in the documentation? Would be great to not to confuse people like me and tell that you have to unpack everything and remove other stuff which is not needed for current platform you working on right now.

Anyways thank you @garrynewman for a clarification.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tip - How to fix "Random is an ambiguous reference " error
When you use two namespaces which both declare a class with same name, you will get this error. There, both System and UnityEngine...
Read more >
'Random is is ambiguous reference between 'Unity. ...
Open up the file, look for the problematic line. Try to read the error message again and then read the line it is...
Read more >
C# Error CS0104 – 'reference' is an ambiguous reference ...
You will receive this error when you are trying to access a class where the same name is available in multiple namespaces that...
Read more >
Ambiguous reference with local NuGet package
As my locally built NuGet package and the RC2 output use differing implementation, the compiler is unable to determine which one is correct....
Read more >
vb.net - .Net Office Ambiguous Reference [SOLVED]
Tried creating a new project, adding the same reference(Office 12) and it all works ok, I got the MsoTriState suggestion and it compile...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found