(:3[kanのメモ帳]

個人ゲーム開発者kan.kikuchiのメモ的技術ブログ。月木更新でUnity関連がメイン。

(:3[kanのメモ帳]


本ブログの運営者kan.kikuchiが個人で開発したゲームです!

    

Steamworksの初期化がSteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.というエラーで失敗する時の対処法【Unity】【Steam】【トラブルシューティング】


このエントリーをはてなブックマークに追加


この記事でのバージョン
Unity 2019.4.9f1


はじめに

UnityでSteam向けのゲームを作る際はSteamworks.NETを使うと楽にSteam対応が出来ます。



そのSteamworks.NETを使う際、最初に初期化が必要なのですが、

//SteamManager等を使うのに必要
using Steamworks;
//初期化
if (!SteamManager.Initialized) {
 Debug.LogWarning("SteamManagerの初期化に失敗しました");
  return;
}


この初期化時に以下のようなエラーが出る事があります。

f:id:kan_kikuchi:20200913121243j:plain

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

DeepL翻訳
SteamAPI_Init() に失敗しました。詳細については、Valve のドキュメントまたはこの行の上のコメントを参照してください。


エラー内容の通り、コメントに原因が色々書いてあるので、

// Initializes the Steamworks API.
// If this returns false then this indicates one of the following conditions:
// [*] The Steam client isn't running. A running Steam client is required to provide implementations of the various Steamworks interfaces.
// [*] The Steam client couldn't determine the App ID of game. If you're running your application from the executable or debugger directly then you must have a [code-inline]steam_appid.txt[/code-inline] in your game directory next to the executable, with your app ID in it and nothing else. Steam will look for this file in the current working directory. If you are running your executable from a different directory you may need to relocate the [code-inline]steam_appid.txt[/code-inline] file.
// [*] Your application is not running under the same OS user context as the Steam client, such as a different user or administration access level.
// [*] Ensure that you own a license for the App ID on the currently active Steam account. Your game must show up in your Steam library.
// [*] Your App ID is not completely set up, i.e. in Release State: Unavailable, or it's missing default packages.
// Valve's documentation for this is located here:
// https://partner.steamgames.com/doc/sdk/api#initialization_and_shutdown


今回はこれを一つずつ解説していこうという感じの記事です!


Steamが起動してない

The Steam client isn't running. A running Steam client is required to provide implementations of the various Steamworks interfaces.

DeepL翻訳
Steam クライアントが動作していません。さまざまな Steamworks インターフェイスの実装を提供するには、Steam クライアントが動作している必要があります。


Steamworksの機能を使うにはSteamのクライアント(アプリ)を起動している必要があります。

なので、Steam向けゲームを開発中は常にSteamを起動しておくようにしましょう。


steam_appid.txtが作成されていない

The Steam client couldn't determine the App ID of game. If you're running your application from the executable or debugger directly then you must have a [code-inline]steam_appid.txt[/code-inline] in your game directory next to the executable, with your app ID in it and nothing else. Steam will look for this file in the current working directory. If you are running your executable from a different directory you may need to relocate the [code-inline]steam_appid.txt[/code-inline] file.

DeepL翻訳

Steam クライアントがゲームの App ID を判断できませんでした。実行ファイルやデバッガから直接アプリケーションを実行している場合は、実行ファイルの隣のゲームディレクトリに steam_appid.txt を作成する必要がありますが、その中にはアプリ ID が含まれており、他には何もありません。Steamはこのファイルを現在の作業ディレクトリで探します。実行ファイルを別のディレクトリから実行している場合は、steam_appid.txファイルを再配置する必要があるかもしれません。

Unity上ではなくビルドして実行ファイルで確認している時は、

実行ファイルと同じ階層(ディレクトリ)にsteam_appid.txtが必要になります。

f:id:kan_kikuchi:20200915070519j:plain


特にMac向けにビルドするとsteam_appid.txtが自動で書き出されないので、注意が必要です。


Steamのクライアントとゲームを実行しているユーザが違う

Your application is not running under the same OS user context as the Steam client, such as a different user or administration access level.

DeepL翻訳
アプリケーションが、異なるユーザーや管理者アクセスレベルなど、Steamクライアントと同じOSユーザーコンテキストで実行されていません。

同じPC上であっても、

Steamのクライアント(アプリ)とゲームを実行しているユーザは同じにする必要があります。


アカウントに権限がない

Ensure that you own a license for the App ID on the currently active Steam account. Your game must show up in your Steam library.

DeepL翻訳
現在アクティブなSteamアカウントでApp IDのライセンスを所有していることを確認してください。ゲームが Steam ライブラリに表示されている必要があります。

開発中のゲームをプレイするには権限(ライセンス?)が必要なので、

SteamクライアントにSteamworksのアカウントでログインするか、

Steamにログインしているアカウントに権限を付与しましょう。


App IDの設定が間違っている

Your App ID is not completely set up, i.e. in Release State: Unavailable, or it's missing default packages.

DeepL翻訳
App ID が完全に設定されていません。つまり、リリース状態: Unavailable(利用できません)、またはデフォルトのパッケージがない状態です。

おそらくこれはApp IDが間違っている(ので利用出来ない)という事だと思います。

steam_appid.txtに記載されている文字列を確認してみましょう。