Open RestlessSwords opened 3 years ago
I am having this same issue. I am trying to migrate from Unity/Xbox Live over to Steam and this is one of the first things I have run into. Strangely it still sort of works... I have a feeling for me it's something stupid, like adding something into the scripting define symbols, but I am a little lost on how else to address it.
If I have Steam running when I try to test my game within Unity, it will correctly output the "SteamFriends.GetPersonaName();" but within Visual Studio I am still seeing the red lines, and the error in the VS Error List saying "The type or namespace 'Steamworks' could not be found..."
I just tried to import the Steamworks.NET unity package into my project, and got this error too.
Assets\Scripts\Steamworks.NET\SteamManager.cs(15,7): error CS0246: The type or namespace name 'Steamworks' could not be found (are you missing a using directive or an assembly reference?) Assets\Scripts\Steamworks.NET\SteamManager.cs(46,12): error CS0246: The type or namespace name 'SteamAPIWarningMessageHook_t' could not be found (are you missing a using directive or an assembly reference?) Assets\Scripts\Steamworks.NET\SteamManager.cs(48,34): error CS0246: The type or namespace name 'SteamAPIWarningMessageHook_t' could not be found (are you missing a using directive or an assembly reference?)
I read elsewhere that it happened when on the Android platform, but I'm set to "PC, Mac & Linux Standalone". I even tried changing to Android and then back, but the problem is still there. It seems worse than what Tresiris is reporting - I cannot run or build because Unity says I cannot while I have compile errors in my scripts.
Possible reason for cases above is all project Scripts are wrapped to Assembly (i.e. having .asmdef file in root).
Unitypackage extracted to several project folders: Plugins, Scripts, Editor
.
So Scripts/Steamworks.NET/SteamManager.cs is placed beyond project assembly, but trying to reference Steamworks namespace which is not available, because those scripts are located in Plugins subdir.
Solution is simple: create Assembly Definition file in Plugins/Steamworks.NET (i.e. Steamworks.asmdef). Import it in asmdef inside a Scripts folder. And add a namespace namespace Steamworks.NET
to SteamManager.cs
Possible reason for cases above is all project Scripts are wrapped to Assembly (i.e. having .asmdef file in root).
Unitypackage extracted to several project folders:
Plugins, Scripts, Editor
.So Scripts/Steamworks.NET/SteamManager.cs is placed beyond project assembly, but trying to reference Steamworks namespace which is not available, because those scripts are located in Plugins subdir.
Solution is simple: create Assembly Definition file in Plugins/Steamworks.NET (i.e. Steamworks.asmdef). Import it in asmdef inside a Scripts folder. And add a namespace
namespace Steamworks.NET
toSteamManager.cs
This sounds really simple - except I don't know how to do this stuff :) Would it be possible for you to explain how to do this as dummy-friendly as possible, for a noob like me?
This sounds really simple - except I don't know how to do this stuff :) Would it be possible for you to explain how to do this as dummy-friendly as possible, for a noob like me?
Just find tutorial of how to work with Assembly Definitions and Assembly References in C# / Unity. Next: place Assembly Definition to Plugins and make a reference from the main Assembly Definition of your project (create one if not exists) where SteamManager.cs is located after import.
Even with the Assembly definitions, my CI sometimes get stuck on this. Its a really weird issue as I don't always get it.
@madc0der Is there anything I can do to make this easier? I don't seem to get this issue in https://github.com/rlabrecque/Steamworks.NET-Example on Unity 2019.4 or 2020.3
Also what version of Unity are you all using, and what version of Steamworks.NET, including how are you "installing" it, unitypackage, manually, unity package manager?
@madc0der Is there anything I can do to make this easier? I don't seem to get this issue in https://github.com/rlabrecque/Steamworks.NET-Example on Unity 2019.4 or 2020.3
Also what version of Unity are you all using, and what version of Steamworks.NET, including how are you "installing" it, unitypackage, manually, unity package manager?
Were there multiple asmdefs in your test projects for 2019/2020 ? Unity allows to create projects even w/o asmdefs and in those cases (probably) all fine.
Mine (2020.3) was with several asmdefs and dependencies between them. And the problem I described above appeared (https://github.com/rlabrecque/Steamworks.NET/issues/439#issuecomment-926274489). I don't think it depends on Unity version but just because of mix of assembly scopes/namespaces. Class SteamManager is in Steamworks.NET namespace but outside of any assembly. Other classes are in Steamworks.NET namespace and in assembly. So if i'm working in my project assembly and link to Steam-client assembly I will not see SteamManager class.
Anyway, if you have time, you can put all the scripts under corresponding asmdefs and it'll solve the problem.
Right yeah, the Example project contains no asmdef's directly in it. That makes sense, thanks
Try right clicking on the steam plugin folder and select "reimport". This worked for me.
It may not have installed Steamworks.NET for you. There is an URL link in their Github Page where you can install it via Unity Package Manager. This is what solved it for me.
I am having this same issue. I am trying to migrate from Unity/Xbox Live over to Steam and this is one of the first things I have run into. Strangely it still sort of works... I have a feeling for me it's something stupid, like adding something into the scripting define symbols, but I am a little lost on how else to address it.
If I have Steam running when I try to test my game within Unity, it will correctly output the "SteamFriends.GetPersonaName();" but within Visual Studio I am still seeing the red lines, and the error in the VS Error List saying "The type or namespace 'Steamworks' could not be found..."
I fixed the "red squiggly line issue" by going to Unity / Edit / Preferences; selecting "External Tools", and clicking "regenerate project files"
I noticed when none of these were working it's because Steamworks was added to one of my Android dependencies since my project settings were set to build on Android (working on something that will be on mobile and PC). So I just removed everything related to Steamworks SDK, changed my project settings to PC - Windows, reimported via git url/package manager, and now it works.
It may not have installed Steamworks.NET for you. There is an URL link in their Github Page where you can install it via Unity Package Manager. This is what solved it for me.
Thx fixed my issue
It may not have installed Steamworks.NET for you. There is an URL link in their Github Page where you can install it via Unity Package Manager. This is what solved it for me.
This works, thanks.
I added link to com.rlabrecque.steamworks.net in the Unity inspector. It helped
I searched google which lead to the previous error #346 now closed here. I get this error as well (trying to compile/run inside unity editor), and am close to giving up on steamworks + facepunch.
It is august-2021, I am using unity LTS-2020-12f, and imported the latest steamworks.net-15.0.1
do I have to do anything to install/use facepunch-2.3.2 somehow? Any recommendation or solution