Can't compile game with ambiguous reference message
See original GitHub issueDescribe 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:
- You need to have empty Unity project 😉
- Download v2.3.2 release zip from github and do exactly what is on the https://wiki.facepunch.com/steamworks/Installing_For_Unity
- Unpack zip and Unity folder contents to Assets/Plugins/Facepunch.Steamworks
- 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);
}
}
}
}
- Attach to any empty component on the scene in Unity
- Try to compile
Calling Code
Code is pasted above.
Got this in the code:
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:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
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
That’s fine, but the docs clearly states to unpack everything into plugins folder. This is how I understood that.
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.