0

我正在为 Steam 使用 Unity 开发游戏。我正在统一使用 SteamWorks.net 包。我的成就系统运行良好但 SteamOverly 上的暂停游戏无法正常工作。我正在尝试从 Unity Editor 运行。我有任何方法可以从统一编辑器中测试它。我为此使用以下代码

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using Steamworks;

public class SteamScript : MonoBehaviour {
    protected Callback<GameOverlayActivated_t> m_GameOverlayActivated;

    private void OnEnable() {
        if (SteamManager.Initialized) { //This working
            Debug.Log("INIT");
            m_GameOverlayActivated = Callback<GameOverlayActivated_t>.Create(OnGameOverlayActivated);
        }
    }

    private void OnGameOverlayActivated(GameOverlayActivated_t pCallback) {

           Debug.Log("Entered"); //This is not workinfdg

           // this is not calling
        if(pCallback.m_bActive != 0) {
            Debug.Log("Steam Overlay has been activated");
        }
        else {
            Debug.Log("Steam Overlay has been closed");
        }
    }
}
4

1 回答 1

0

蒸汽覆盖在编辑器中不起作用,您需要进行构建。请参阅此处的文档:https ://steamworks.github.io/faq/#can-steamworksnet-be-used-within-the-unity-editor

于 2020-05-10T01:19:34.813 回答