[Blueprints Tutorial] Accessing Steam User ID and making it accessible to other blueprints

So in looking up how to do this I noticed there was a lack of any sort of guide, but I was able to eventually piece the process together and figured I’d share it for those looking to do it too.

(NOTE: This tutorial assumes you already know how to integrate the Steam SDK)

Once Steam has been properly integrated, the process is actually pretty straightforward:
Firstly, go to your Player Controller, and create a String Variable, and name it what you want and make it editable (I chose Steam Player ID) and hit compile.
Now off of your Event (I chose to use “Event Begin Play”), create a Set command for your variable (Steam Player ID). Then, we need to provide the string with input, so right-click and search for “Get Player State”.

Then drag off of the Player State and “Get Player Name” (when logged into Steam this will be the Steam Username), then connect it to the “Steam Player ID” String Variable we created.

When done, it should look like this:

Now that alone is enough to provide you with a usable string of the SteamID, but it doesn’t make it usable by other blueprints. So we need to create a Blueprint Interface.

Right-click in the content browser, and select Blueprint Interface (under blueprints), and name it what you want.
Inside it, add a function and give it a Text Output (you could use a string instead and not have to convert later, but I want to use mine for a text value), and compile.
It should look something like this:

Now back in the Player Controller, go to Class Settings, and add the interface we just created:

You’ll now see it listed in the interfaces dropdown, below functions. (you may have to compile first, I don’t remember if I did)
Double-click on it, to open it in a new tab, Get your “SteamPlayerID” variable and convert it to a text variable and plug it into the ReturnNode, like so:

From there, you can call that Interface as a message in another Blueprint, and get the value. (You’ll need to run as a “Standalone Game” with Steam active and logged in for it to work)

How about an example?
In my UMG blueprint for my menu, I’m going to use the SteamID to show who is playing on the Main Menu.
So I create the desired Text field on my UMG, and make it a variable (check the “Is Variable?” by the object name) and compile.

Now in the graph, I create a Set Text command for my Text variable, and then right-click and search for the interface we created, in my case I got this:

Make the Target for that function “Get Player Controller” and connect the text output you created into the “In Text” of your Set Text command.

That may have sounded confusing, so here is what it would look like:


Now that we’ve got the ID accessible, let’s use it in UMG to identify who the player is.
(And on the off chance the game is being played without Steam (and possibly even Internet) we will set it to use the user currently logged into the OS, like so:

To do this, go back to your Player Controller, where we pulled the Player State and Name.
Instead of just setting the Steam Player ID, we’re going to create a Branch. Connect the False end of the Branch to the Set “Steam Player ID” variable we created previously.
Now from your Player Name variable, create a Equal To comparison for the String, and leave the lower input blank (if Steam isn’t present, then the Player Name variable will be empty by default, so this will check if that is true) then make the output of the Equal To check the condition for the Branch.

Now for the True Branch, Create a second Set “Steam Player ID”, and for it’s input, use “Get Platform User Name”.

When done it will look something like this:

Now compare it by running the standalone game with and without Steam active!


Ty! I was needing this, I just now need to know how to integrate facebook SDK to UE4

I’m fairly certain that, at least currently, you would need some C++ to integrate something like that. I’m no expert, but I saw several people asking about that when I was researching how to do this, and I don’t believe there is currently a blueprint system to do it.

Thank you very much for this :slight_smile:

Buuut, that is not the SteamID, is it? :O. This is just the Username. The unique SteamID isn’t exposed to BP yet.
Maybe name it differently?

Still thanks for this tutorial! (:

My mistake, there is a “PlayerID” you can return, which I would assume to be pulling some form of info from steam, but it doesn’t seem to match.

Sadly not. Several user already tried to get the SteamID from that. But there are also threads showing how to expose the Unique SteamID to the BP.
Is it ok if i rename your thread a bit, so it matches the Topic? I would change the “SteamUserID” to “SteamUserName”.

Certainly. I found one of the threads in question, and it led me to believe they were successful, but the C++ code supplied didn’t seem to expose anything. I’ll look into it again when I get home.

/** Unique net id number. Actual value varies based on current online subsystem, use it only as a guaranteed unique number per player. */
	UPROPERTY(replicated, **BlueprintReadOnly**, Category=PlayerState)
	int32 PlayerId;

	/** The id used by the network to uniquely identify a player.
	 * NOTE: the internals of this property should *never* be exposed to the player as it's transient
	 * and opaque in meaning (ie it might mean date/time followed by something else).
	 * It is OK to use and pass around this property, though. */
	FUniqueNetIdRepl UniqueId;

These are the two player IDs in the player state, the UniqueId contains the steam id, they override ->ToString() on it to give the full 64 bit ID in OnlineSubsystemSteam.
They don’t have the UniqueId exposed to blueprints though and seem to use the PlayerId just as an index in the server.

I’m sure someone had already looked into the API documentation, but it talks about being able to call it in C++

I haven’t been able to actually look into this yet, but does a process like this not work to get the actual ID?

Hi !

First of all, thank you very much for this tutorial :slight_smile:

However it doesnt work on my project, the “Player Name” from “Player State” returns “Player”.

My two leads so far:

  • maybe I failed at integrating Steam SDK to my project. But since I have the Steam overlay spawning when launching the game with Steam, I feel like it’s working
  • I’m using a custom Player State class, maybe it doesnt receive the informations regarding the Steam Username?

Any tip appreciated :wink:

Have a good day

EDIT: After a deeper research I think it only comes from the fact that my Steam isnt integrated properly. Will post any update if it still fails to recognize the player name after a successful integration.

Based on what I know, I’d say it’s the Steam integration, just at a first guess. It is possible a custom player state would have issues I suppose, but without trying it, I have no idea. Let me know what you learn and I’ll try to help.

Sorry about the late answer on this one, the CSteamId is hidden within the OnlineSubsystemSteam Interface, they want it abstracted away so that you can write a front end that works with multiple networking backends. That is why the Steam ID is exposed through converting the UniqueNetId to string.

I have been completing a plugin that exposes everything to blueprint because it felt needed for people to have and it includes getting the UniqueId.

Here is a video on how to get the Steam Player ID via blueprints if that helps.

1 Like

it doesnt work

This is soooo helpful, TY!