> For the complete documentation index, see [llms.txt](/llms.txt)

# Implementation

Game Development with GS2




GS2-SDK provides SDKs tailored to game engines.
Developers using Unity, Unreal Engine 5, and Godot can take advantage of the various features provided by these SDKs.

## Unity

"GS2-SDK for Unity" is available as an SDK for Unity.
It is fully integrated with the Unity Package Manager (UPM) and SDK updates can be done through UPM.

Dependent libraries are [LitJSON](https://litjson.net/)(Public Domain) / [websocket-sharp](https://github.com/sta/websocket-sharp)(MIT) / [Protocol Buffers](https://developers.google.com/protocol-buffers)(BSD).
The GS2-SDK for Unity is available under Apache License 2.0 and all source code is available in the following GitHub repository

- https://github.com/gs2io/gs2-csharp-sdk
- https://github.com/gs2io/gs2-sdk-for-unity
- https://github.com/gs2io/gs2-uikit-for-unity

The GS2-SDK for Unity provides state management capabilities for data retrieved from the server.
Data retrieved through the API is cached in a layer of the SDK, and when server values are updated, the cache is automatically updated as well.

Therefore, developers can call the GS2-SDK API from the Update function to access the latest values without having to think about reading data.

### Example Implementation

```csharp
    var result = await gs2.Account.Namespace(
        namespaceName: "namespace-0001"
    ).CreateAsync();

    var item = await result.ModelAsync();
    var userId = item.UserId;
    var password = item.Password;
```

### GS2-UIKit for Unity

![uikit.png](uikit.png)

This is a more Unity-specific SDK.

By simply adding a component to a GameObject in the Unity editor, you can add a component to the text of the GameObject to reflect the number of items it has.
You can enable or disable GameObjects depending on whether or not the limit has been reached.

If the implementation is as simple as retrieving data from the server and displaying it in the UI, the UI Kit can be used to accomplish this without any code.

## Unreal Engine 5

GS2-SDK for Unreal Engine is available as an SDK for Unreal Engine 5.
It is provided as a plugin for Unreal Engine and can be integrated into your project by simply placing code.

There are no external libraries to depend on and everything is implemented using standard Unreal Engine 5 functionality.
GS2-SDK for Unreal Engine is licensed under Apache License 2.0 and all source code is available in the following GitHub repository

- https://github.com/gs2io/gs2-sdk-for-ue5

### Example Implementation

```cpp
    const auto Domain = Gs2->Account->Namespace(
        "namespace-0001" // namespaceName
    );
    const auto Future = Domain->Create(
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError()) return false;

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (!TestFalse(WHAT, Future2->GetTask().IsError()))) return false;
    const auto Result = Future2->GetTask().Result();
```

### Blueprint SDK

![blueprint.png](blueprint.png)

This SDK is more specific to Unreal Engine 5.

This SDK supports Blueprint, a node-based programming environment that can be developed in the Unreal Editor.
The Blueprint SDK allows you to access GS2 functionality without having to use C++.

## Godot

GS2 SDK for Godot is available for Godot 4 (GDScript).
The SDK is provided as an `addons/gs2` folder that you can copy into a Godot project.

GS2 SDK for Godot includes both an Ez layer designed for use from games and a low-level API client. After creating `Gs2EzDomain`, access each feature through service properties such as `ez.account` and `ez.inventory`, matching Unity's `gs2.Account` style.
It is distributed under the Apache License 2.0, and all source code is available in the following GitHub repository:

- https://github.com/gs2io/gs2-sdk-for-godot

### Example Implementation

```gdscript
var credential = Gs2BasicCredential.new("client-id", "client-secret")
var connection = Gs2Connection.new(credential, Gs2Region.AP_NORTHEAST_1)
var ez = Gs2EzDomain.new(connection)

var create_result = await ez.account.namespace_(
    "namespace-0001"
).create()
if create_result.error != null:
    push_error(str(create_result.error))
    return

var model_result = await create_result.result.model()
if model_result.error != null:
    push_error(str(model_result.error))
    return

var account = model_result.result
print("UserId: ", account.user_id)
print("Password: ", account.password)
```




- [Extend](/overview/workflow/coding/extend/)
  
