无法将类型“ Steamworks.CSteamID”隐式转换为“ float”

pap*_*api 1 c# unity-game-engine steamworks-api

我目前正在将Steamworks.net与Unity3d和C#结合使用。我要做的是获取Steam用户ID(在这种情况下为我自己的ID),然后执行一个函数。

这是我到目前为止的内容:

private static float berdyevID = 76561198040013516;
private static float steamID;


void Start() {

    if(SteamManager.Initialized) {

        string name = SteamFriends.GetPersonaName();

        // get steam user id
        steamID = Steamworks.SteamUser.GetSteamID();

        // see if it matches
        if (berdyevID == steamID) {

            Debug.Log ("Steam ID did match");
        } else {

            Debug.Log ("Steam ID did not match");
        }


    }

}
Run Code Online (Sandbox Code Playgroud)

我从Unity收到一个错误,指出:

无法隐式转换类型Steamworks.CSteamID' tofloat'。存在显式转换(您是否缺少演员表?)

这让我感到困惑。我尝试在Google上进行研究,以找到可能的解决方法,但找不到任何东西。有人可以帮忙吗?

编辑

我试过了,但是没有用:

private static ulong berdyevID = 76561198040013516;
private static ulong steamID;

void Start() {

    if(SteamManager.Initialized) {

        string name = SteamFriends.GetPersonaName();

        // get steam user id
        steamID = Steamworks.SteamUser.GetSteamID();

        // see if it matches
        if (berdyevID == steamID) {

            Debug.Log ("Steam ID did match");
        } else {

            Debug.Log ("Steam ID did not match");
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Sur*_*yan 5

GetSteamID()返回的对象类型Steamworks.CSteamID不能分配给steamIDtype 变量float

在结构中有一个ulong名为m_SteamID变量的变量CSteamID。这是ID所在的位置。

private static ulong berdyevID = 76561198040013516;
private static ulong steamID;


void Start() {

    if(SteamManager.Initialized) {

        string name = SteamFriends.GetPersonaName();

        // get steam user id
        steamID = Steamworks.SteamUser.GetSteamID().m_SteamID;

        // see if it matches
        if (berdyevID == steamID) {

            Debug.Log ("Steam ID did match");
        } else {

            Debug.Log ("Steam ID did not match");
        }
    }
}
Run Code Online (Sandbox Code Playgroud)