# PC SDK Unity Follow Through

It's an example to follow to learn how to apply STOVE PC SDK 2.0 to a Unity engine game.

confirm Before proceeding with the following example, install STOVE Launcher (opens new window) in advance and Preparing SDK development environment (opens new window) and obtain App key, App secret, and Game Id in advance. For example, we recommend Unity 2017 or higher, VisualStudio 2017, or higher version.

# Setting up STOVE Launcher

(1) Download STOVE Launcher from Download PC Client (opens new window).

(2) Create a PolicyConfig.json file in the folder where STOVE Launcher is installed.

  • Live default installation location : C:\Program Files (x86)\Smilegate\STOVE

(3) Enter the following contents in the PolicyConfig.json file and create it when registering the STOVE Studio project.

Warning

You must be logged in after running the STOVE launcher during SDK integration.

After creating PolicyConfig.json with the structure like below, add the following to it

  • Live : C:\Program Files (x86)\Smilegate\STOVE

Check the Game ID and replace it.




 



{
  "skip_check_game_list":
  [
    "id_hellostove"
  ]
}
1
2
3
4
5
6

Note

You can change "id_hellostove" to the gameID registered with STOVE Partners.

(4) Run the STOVE Launcher and log in with the gameID you registered with STOVE.

# Downloading a Follow Through HelloStove Project

Unzip it when the download is complete.
This project doesn't have the PC SDK integrated yet. Let's start integrating the PC SDK

# 1) Download the project

Once downloaded, unzip it.
This project doesn't have the PC SDK linked yet. Let's start integrating the PC SDK now.

# 2) Download the Unity package

If you are using a different version of Unity, download the HelloStove_UnityPackage archive from the link below. Create a project with your version of the Unity Editor and follow along.

Once the download is complete, unzip it. Import the HelloStove_UnityPackage.unitypackage custom package under the project Assets folder you created.

# 3) Open the following project

This project doesn't have the PC SDK linked yet. Let's start integrating the PC SDK now. In the Unity Editor, open the HellowStove_Unity project (or a project of your own creation)

# Configuring Project Settings

  • Download the latest version of the Unity (C#) distribution file (from now on referred to as StovePCSDK_NET) from the STOVE PC SDK download page.

After unpacking StovePCSDK_NET, delete the x86 (32 bit) folders or the x86_64 (64 bit) folder, and then copy (overwrite) the StovePCSDK folder to the Assets folder of the HelloStove_Unity project. If both the x86 folder and the x86_64 folder exist, a build error may occur.

# 1) Execute Scenes

Open the HellowStove_Unity project in the Unity Editor.
Click on the Play button in the editor toolbar.
It plays the scene in the game view if all settings are standard.
Click on the Play button in the editor toolbar once more to close the playing scene.

Figure1

# 2) Building

Click on the File > BuildSetting menu.
Click on the Build button in the Build Settings window.
Select the folder to save the resulting build from the build window.
Enter "HelloStove" as the file’s name and click on the save button.
If there are no problems in the settings, the build will be smooth without any compiling errors.

Figure1

# 3) Getting Ready to Write Scripts

Open the Assets > StovePCSDK > Scenes > Scripts > StovePCSDKManager.cs file.

Figure1

# 4) StovePCConfig

Open the file Assets > StreamingAssets > Text > StovePCConfig.Unity.txt Fill in the AppKey, AppSecret, and GameId values issued in advance from Stove Studio (opens new window) and save it.

Figure1

confirm You need to change "YOUR_APP_KEY", "YOUR_SECRET_KEY", and "YOUR_GAME_ID" to the previously issued data. If you call the StovePC.Initialize function without logging into the stove launcher with the STOVE account applied for entry into STOVE Studio, error code 150 (sgup initialization failed) occurs.

# SDK Initialization

To initialize PC SDK, fill in the values for StovePCConfig and StovePCCallback structures, and call the StovePC.Initialize method.
Enter the code piece below in the ButtonInitialize_Click method.

StovePCConfig config = new StovePCConfig
{
    Env = this.Env,
    AppKey = this.AppKey,
    AppSecret = this.AppSecret,
    GameId = this.GameId,
    LogLevel = this.LogLevel,
    LogPath = this.LogPath
};

this.callback = new StovePCCallback
{
    OnError = new StovePCErrorDelegate(this.OnError),
    OnInitializationComplete = new StovePCInitializationCompleteDelegate(this.OnInitializationComplete),
    OnToken = new StovePCTokenDelegate(this.OnToken),
    OnUser = new StovePCUserDelegate(this.OnUser)
};

sdkResult = StovePC.Initialize(config, callback);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

Precautions

The PCSDK log path must be set as an absolute path. ex) C:\Program Files\{Your Game Folder}\Logs Do not add "\" at the end. PCSDK automatically adds the file name "StovePCSDK.log".
If "" is set as an empty string, PCSDK automatically creates a log in the path of the game executable file folder or the folder where the PCSDK DLL is located.

YOUR_APP_KEY, YOUR_SECRET_KEY, YOUR_GAME_ID must be changed to data issued in advance.
An error occurs if you call the StovePC.Initialize function without logging into the Stove Launcher.

Write a callback when the StovePC.Initialize function call usually completes. Write the code snippet below in the OnInitializationComplete method.

sb.AppendLine("OnInitializationComplete");
sb.AppendFormat(" - nothing");
1
2

# SDK Termination

To clear the currently used resources after using STOVE Service, call the StovePC.Uninitialize method.
Enter the code piece below in the ButtonUninitialize_Click method.

sdkResult = StovePC.Uninitialize();
1

# Acquiring User Information

Call the StovePC.GetUser method to acquire the information of a logged in user.
Enter the code piece below in the ButtonGetUser_Click method.

sdkResult = StovePC.GetUser();
1

To get the logged-in user information, call the GetUser method. Write the code snippet below in the OnUser method.

sb.AppendLine("OnUser");
sb.AppendFormat(" - user.MemberNo : {0}" + Environment.NewLine, user.MemberNo.ToString());
sb.AppendFormat(" - user.Nickname : {0}" + Environment.NewLine, user.Nickname);
sb.AppendFormat(" - user.GameUserId : {0}", user.GameUserId);
1
2
3
4

# Acquiring Token Information

Call the StovePC.GetToken method to acquire the token information of a logged-in user.
Enter the code piece below in the ButtonGetToken_Click method.

sdkResult = StovePC.GetToken();
1

confirm What is a token? It is the access token of the logged-in user in STOVE Launcher, and the game server passes this access token to the stove authentication server to validate the logged-in user.
For a detailed explanation of Access Token, please get in touch with store.support@smilegate.com for technical support.

Write a callback function when the GetToken function call usually completes. Write the code snippet below in the OnToken method.

sb.AppendLine("OnToken");
sb.AppendFormat(" - token.AccessToken : {0}", token.AccessToken);
1
2

# Build and Execute

Save the written script.
Click on the File > Build & Run menu in the Unity Editor.

Figure1

Set the screen resolution field value as 1024 x 768, and check on the Windowed check box.
Click on the Play! Button.

confirm If you set a different resolution, it may not display some buttons correctly.

Figure1

Congratulations!
You have successfully completed the HelloStove Follow Through.

Last Updated: 11/22/2023, 1:25:27 PM