New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information. #83

Open
Kew opened this Issue Dec 29, 2015 · 36 comments

Comments

Projects
None yet
@Kew
Copy link

Kew commented Dec 29, 2015

Hi,
I'm running Unity 5,3,1f Personal.

My first game was recently Greenlit http://steamcommunity.com/sharedfiles/filedetails/?id=542685634 so this is my first time getting a game onto Steam.

I imported the SteamWorks.NET Unity component as per the instructions here https://steamworks.github.io/installation/

steam_api.dll did not appear in the root, but the steam_appid.txt did and I edited it, making it my own appid. While poking around I found steam_api.dll under Assets/Plugins/x86.

So not 100% sure that the import went correctly.

When I have steam running and launch the game in Unity UI I get this error. Same if I run a stand alone build.

[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information. UnityEngine.Debug:LogError(Object, Object) SteamManager:Awake() (at Assets/Scripts/Steamwork.NET/SteamManager.cs:97)

Is this normal? Is it because I am not launching it from Steam?

@gamenew09

This comment has been minimized.

Copy link

gamenew09 commented Dec 30, 2015

Copy the steam_api.dll into the executable folder. That should work.

@Kew

This comment has been minimized.

Copy link

Kew commented Dec 30, 2015

Manged to solve it by taking a leap of faith and uploading a depot to SteamWorks and it worked!

Didn't have to copy steam_api.dll into the root. When I build the binary it ends up there anyway.

So it looks like that error is what happens when you don't launch it from Steam?

@Kew

This comment has been minimized.

Copy link

Kew commented Dec 30, 2015

On another machine, The first time I launched the game from Steam I got the error.

[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information. UnityEngine.Debug:LogError(Object, Object) SteamManager:Awake() (at Assets/Scripts/Steamwork.NET/SteamManager.cs:97)

Subsequent times, all good.

@thestonefox

This comment has been minimized.

Copy link

thestonefox commented May 17, 2016

I'm having this same issue in the Unity editor. How can you launch your game within the Unity editor and get support for Steamworks?

Doesn't seem valid that you have to do a build to test the Steamworks functionality.

Also, when I did the import of the Steamworks.Net unitypackage it didn't copy the dll's to the root directory (which I believe is now the correct process?)

I have my steam_appid.txt file in my root directory and I updated the number.

I've run DbgView and I don't see any output from Steam that would shed any light on what the issue may be.

Unity 5.3.4f1 64 bit

@thestonefox

This comment has been minimized.

Copy link

thestonefox commented May 17, 2016

I've resolved the issue, I'll post in case someone else hits the same problem.

The issue is because my app ID is for an unpublished app and my steamworks account is not the same as the account I log into steam on my desktop with, it means the API doesn't have permission to access the App ID.

I resolved it by adding a permission for my desktop steam account within my steamworks web page and now it's working.

This is probably obvious to most people! :) but if you're stumped like I was, then try this! :)

@Astiolo

This comment has been minimized.

Copy link

Astiolo commented May 18, 2016

I'm having a similar problem. When I run my game within Unity, DbgView reports that it's "unable to locate a running instance of Steam, or a local steamclient64.dll". But with a build (without a local steam_appid.txt) it works fine.

I've got the steam_api64.dll in the root directory and I've tried it with and without the appid file, but it's the same result.

What I find strange is that when I put the appid file in the build directory it creates the same problem when I thought you had to put it there to solve it. I have triple checked that it's got the correct id in it.

@Astiolo

This comment has been minimized.

Copy link

Astiolo commented May 18, 2016

Looks like I just had to run Unity as administrator

@sonnyg007

This comment has been minimized.

Copy link

sonnyg007 commented Jun 24, 2016

@thestonefox Thanks for taking the time to post your fix. Was stuck for a few hours trying to figure what was the problem. Making sure the user logged into steam had permissions for the AppID did the trick.

@Tagette

This comment has been minimized.

Copy link

Tagette commented Aug 4, 2016

@Astiolo Did you ever find a better solution then running Unity as administrator? Seems bad to force a customer to launch the game as administrator every time they play the game. It is also quite annoying as a developer. I have the same issue on my Windows 8 machine using Unity 5.4.0f3. All my other computers don't have this issue.

Edit: It might be worth noting that all my windows accounts are administrator accounts.

@Astiolo

This comment has been minimized.

Copy link

Astiolo commented Aug 5, 2016

@Tagette, The game shouldn't need to be run as admin, just Unity when you're running the game from within the engine. Really you shouldn't need to even do that but it solved the problem for me.

@rlabrecque

This comment has been minimized.

Copy link
Owner

rlabrecque commented Aug 5, 2016

How does your steam launch? Games should be running at the same process elevation as Steam, If Steam is being run as Admin then the Unity Editor will need to be as well.

When you run stuff from Steam it will inherit the same elevation level as Steam itself so it will always work.

@Tagette

This comment has been minimized.

Copy link

Tagette commented Aug 5, 2016

@rlabrecque We have not been launching through steam but I imagine it would have the same issue because we don't have steam run as administrator. We run from the .exe and have the steam_appid.txt present.

@Astiolo It seems we have different issues then. I'm using the same Steamworks .Net in Unity 5.1 and I don't have this issue running it on my windows 8 computer. However a different build running 5.4 fails to load the dll unless it is ran as administrator.

@Magris

This comment has been minimized.

Copy link

Magris commented Aug 18, 2016

@rlabrecque I have same issue
other appid(480 or published) is working but not mine T.T(492610)
What can i do??

Unity 5.3.6 OSX 10.11

@gycot

This comment has been minimized.

Copy link

gycot commented Aug 30, 2016

Giving my alt account permissions solved the biggest problem I had, thanks!

One thing of note - I had to manually copy steam_appid.txt to my build directory, and only then would it start up. Did anyone else have to do the same, or should Build be creating/copying the file to the root of the build dir?

@marnel-estrada

This comment has been minimized.

Copy link

marnel-estrada commented Oct 4, 2016

Hello. I have the same issue. How do you give "account permissions"? Is it to be setup in Steamworks or in Steam?

@rlabrecque

This comment has been minimized.

Copy link
Owner

rlabrecque commented Oct 4, 2016

This is done via one of two ways.

A: Your account must be in your Steamworks partner group.
B: Your account owns the game through a "Developer Comp" (red) CD-Key.

Essentially it just means that your game should show up as playable in your Steam library.

@gycot:
Yes, you need to manually copy steam_appid.txt if you need it. You're not supposed to ship it to customers as Steam injects the appid itself when it's run from Steam. You can ensure that you're running from Steam by calling SteamAPI.RestartAppIfNecessary with your AppId (as is done in SteamManager)

@Nakano37

This comment has been minimized.

Copy link

Nakano37 commented Oct 28, 2016

I've tried everything in this thread and I'm still getting the same SteamAPI_Init() failed error... strangely it works if I replace my appID with 480 in the steam_appid.txt file (comes up as Spacewar, of course). Since that's the case it makes me fairly sure it something wrong with how I've got the app setup, but the user I'm logged in with on steam is an admin on the application with full permissions for everything... Does anyone have any other idea on what I might be missing?

@Wuzseen

This comment has been minimized.

Copy link

Wuzseen commented Nov 3, 2016

I am also experiencing this same issue. I've added my relevant steam accounts on steamworks in the "Everyone" group which should give them permissions on the app right?

@mikeshultz

This comment has been minimized.

Copy link

mikeshultz commented Nov 13, 2016

Having the same/similar problem. At this point I'm not entirely sure where the problem lies(Steamworks.Net, Steamworks SDK). Trying to get a Linux x86_64 build running for a headless server. Game is packaged as a dedicated server and deployed using steamcmd. Potentially relevant info from the logs:

[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
[S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so.
[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.

I can only guess it might have to do with not having a steam client running(I can't for a headless system) but steamcmd should have my credentials. Are there any logs anywhere on Valve's side that can be checked to see if there were permissions issues?

Most of the suggested fixes here or elsewhere just don't work, including the official suggestion of symlinking steamclient.so to .steam/sdk32.

The game is packaged with steampipe(ass a tool as described here on their partner site, which purposely includes steamclient.so and steam_appid.txt as redistributables. But an strace only suggests that it's looking for a pid file isntead of steamclient.so but I'm no expert at reading these traces.

Not really sure where to go from here, but would love some ideas.

@mikeshultz

This comment has been minimized.

Copy link

mikeshultz commented Nov 17, 2016

Looks to be the same problem with both SteamAPI.Init() and GameServer.Init(). On Linux, anyway.

@Nakano37

This comment has been minimized.

Copy link

Nakano37 commented Nov 17, 2016

we had to get help from valve to solve it... something was misconfigured on their end.

@mikeshultz

This comment has been minimized.

Copy link

mikeshultz commented Nov 17, 2016

@Nakano37 Could I ask what avenue you used to get support for that? They have pages on their site that specifically state that no support is offered for Steamworks SDK.

@Wuzseen

This comment has been minimized.

Copy link

Wuzseen commented Nov 17, 2016

Same issue here. Posting on the steamworks dev forum had someone at valve fix it. Our default app configurations were missing

Get Outlook for iOS

On Wed, Nov 16, 2016 at 8:58 PM -0500, "Mike Shultz" notifications@github.com wrote:

@Nakano37 Could I ask what avenue you used to get support for that? They have pages on their site that specifically state that no support is offered for Steamworks SDK.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@Nakano37

This comment has been minimized.

Copy link

Nakano37 commented Nov 17, 2016

Posted on their developer group discussion forum, and after going back and forth with various people, eventually a valve employee answered and was able to look into it.

@mikeshultz

This comment has been minimized.

Copy link

mikeshultz commented Nov 18, 2016

I was entirely mistaken. On Linux, GameServer.Init() worked! When I wrote that post, my conditional was failing between using that and SteamAPI.Init(). So something to keep in mind for anyone trying to get a headless linux server running, I guess.

Now I just have to figure out which calls go with which.

@Phonebox

This comment has been minimized.

Copy link

Phonebox commented Jan 14, 2017

just to note here I was struggling with the same issue. The solution is to restart steam a few times. If it shows up in steam you should be able to play it. Also, I have to note here: I had no problem with a generated test key.

@benmcnelly

This comment has been minimized.

Copy link

benmcnelly commented Feb 13, 2017

Having the same issue. I added my steam app id to the file steamworks.NET created in the root of the project, restarted Unity and Steam multiple times, and I am sure my user has permissions to the steam app.

@rlabrecque

This comment has been minimized.

Copy link
Owner

rlabrecque commented Feb 13, 2017

Hey benmcnelly, have you tried using DbgView to see if Steam is providing and debug information?

https://github.com/rlabrecque/SteamManager/blob/master/SteamManager.cs#L90

@AW111

This comment has been minimized.

Copy link

AW111 commented Jun 23, 2017

I'm getting a "SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient64.dll" error when trying to test Steamworks in the Unity editor. This occurs even when I used the default 480 app ID. Where is steamclient64.dll supposed to be located? I can't find a copy, although everything else seems to have been installed.

@rlabrecque

This comment has been minimized.

Copy link
Owner

rlabrecque commented Jun 23, 2017

It depends on what version of Unity you're on. On modern versions it just has to be next to CSteamworks.dll in the Plugins/x86_64/ folder, on older (<5.2 or so, give or take a version) it needs to be in the project root, NEXT TO 'Assets/', 'ProjectSettings', etc.

What version of Unity are you on? The RedistInstall script should have copied it over for you automatically if it needed to.

@AW111

This comment has been minimized.

Copy link

AW111 commented Jun 23, 2017

Thank you for your reply. A search of the Unity project doesn't find steamclient64.dll anywhere in the hierarchy, though (there are two folders with a similar name, but the file itself isn't there). Does it have to be downloaded separately?

@rlabrecque

This comment has been minimized.

Copy link
Owner

rlabrecque commented Jun 25, 2017

Oh sorry, I kind of misread that!

The local steamclient.dll is only for dedicated servers. In most cases it's just trying to find a running steam client and failing. Valve's new documentation on SteamAPI_Init has better reasons for this. Does your game show up in your Steam library for example?

@AW111

This comment has been minimized.

Copy link

AW111 commented Jun 25, 2017

Yes, it shows up in my Steam library. (and it offers to "download" it although there's no build on Steam - I was just running it in Unity's editor). It says I just "played" it today, so it's evidently able to monitor my usage of it. So what would be the cause of the error I was getting?

@AW111

This comment has been minimized.

Copy link

AW111 commented Jul 6, 2017

It seems to be working now, for whatever reason.

@Suvitruf

This comment has been minimized.

Copy link

Suvitruf commented Jul 7, 2017

Same problem. In editor it works fine.
But in standalone win build I get this error:
[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.

@Tsury

This comment has been minimized.

Copy link

Tsury commented Jul 19, 2018

@Suvitruf Did you end up solving this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment