question

Justin Enayat avatar image
Justin Enayat asked

The name 'SteamName' does not exist in the current context

I've searched on here for answers on how to update the user's display name with their steam name, but I'm new to coding and can't figure out exactly what to do with the information. Basically I want the display name to be updated with what their steam display name is every time they log in, but I can't figure out how to update the display name with their steam name even once.

Here is my log in code:

    void Login()
    {
        if (SteamManager.Initialized)
        {
            var request = new LoginWithSteamRequest
            {
                CreateAccount = true,
                InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
                {
                    GetPlayerProfile = true,
                    GetUserAccountInfo = true
                },
                SteamTicket = GetSteamAuthTicket(),
            }; 
            PlayFabClientAPI.LoginWithSteam(request, OnSuccess, OnError);
        }
    }

In the OnSuccess function, it calls the UpdateDisplayName function. I get the error: The name 'SteamName' does not exist in the current context

    public void UpdateDisplayName()
    {
        var request = new UpdateUserTitleDisplayNameRequest
        {
            DisplayName = SteamName, 
        };
        PlayFabClientAPI.UpdateUserTitleDisplayName(request, OnDisplayNameUpdate, OnError);
    }
apisPlayer Dataunity3dAccount Management
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

Have you got this “SteamName” from steam? If so, I think you may define it as a local variable, a feasible workaround is to define it as a global variable. If you are uncertain about the “SteamName” value, please try to output it in the console before it is referred in the PlayFab API call.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]