PipesMappingで出た不具合の調査で見つけました。
FirebaseのRemote Configで値を読み取ろうとしたときに内部でエラーが発生していました。
Don't call Firebase functions before CheckDependencies has finished
日本語の意味としては、CheckDependenciesの処理が終わるまでFirebaseの処理を呼んではいけない、ということですね。
CheckDependenciesは一番最初に呼んでいますが、非同期なので他の処理でFirebaseの処理を呼ぶときは、
ちゃんと終わるのを待つようにしてみます。
実際のエラーメッセージ
2023/02/24 13:47:01.010 32100 32170 Error Unity InvalidOperationException: Don't call Firebase functions before CheckDependencies has finished
2023/02/24 13:47:01.010 32100 32170 Error Unity at Firebase.FirebaseApp.ThrowIfCheckDependenciesRunning () [0x00000] in <00000000000000000000000000000000>:0
2023/02/24 13:47:01.010 32100 32170 Error Unity at Firebase.FirebaseApp.GetInstance (System.String name) [0x00000] in <00000000000000000000000000000000>:0
2023/02/24 13:47:01.010 32100 32170 Error Unity at Firebase.FirebaseApp.get_DefaultInstance () [0x00000] in <00000000000000000000000000000000>:0
2023/02/24 13:47:01.010 32100 32170 Error Unity at Firebase.RemoteConfig.FirebaseRemoteConfig.get_DefaultInstance () [0x00000] in <00000000000000000000000000000000>:0
2023/02/24 13:47:01.010 32100 32170 Error Unity at FBRemoteConfig.FetchDataAsync () [0x00000] in <00000000000000000000000000000000>:0
2023/02/24 13:47:01.010 32100 32170 Error Unity at FBRemoteConfig.GetStarsTimePeriod (System.Int32 id) [0x00000] in <00000000000000000000000000000000>:0
2023/02/24 13:47:01.010 32100 32170 Error Unity at Settings.GetStarsTimePeriod (System.Int32 id) [0x00000] in <00000000000000000000000000000000>:0
2023/02/24 13:47:01.010 32100 32170 Error Unity at LevelsManager.GetStarsTimePeriod (System.Int32 missionID) [0x00000] in <00000000000000000000000000000000>:0
2023/02/24 13:47:01.010 32100 32170 Error Unity at Timer.Run () [0x00000] in <00000000000000000000000000000000>:0
CheckDependenciesの処理
public FBRemoteConfig()
{
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
{
dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
InitializeFirebase();
}
else
{
Debug.LogError(
"Could not resolve all Firebase dependencies: " + dependencyStatus);
}
});
}
ここでdependencyStatusなる変数に状態が格納されているので、使用箇所でAvailableになっているか確認してからFirebaseの処理を呼ぶようにします。
呼んでいるところ(修正後)
public int? GetStarsTimePeriod(int id)
{
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
return (int)(Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance
.GetValue($"StarsTimePeriod_{id}").LongValue);
}
else
{
return new Nullable<int>();
}
}
修正後の結果
とりあえずこの修正で直るのを確認しました。

-
-
[PipesMapping]バグ情報(1.0.43)
現在分かっているバグ情報です。 バグの詳細 ゲームを開始するとタイマーが0となり、無制限の時間で始まる。 原因(公開可能範囲) 星の取得条件(時間)および制限時間をFirebase RemoteCon ...
続きを見る
環境情報
Unity 2021.3.19f1