Integrations

Plugins Settting

You should set it like this to avoid plugin conflicts. Move the Plugins Folder from Assets/UniversalSDK/Plugins to Assets/Plugins.

Add UniversalSDK prefab to your scene

After importing the package, in your Project panel, you'll find a UniversalSDK prefab under Assets/UniversalSDK/. Drag it to the Hierarchy panel of the scene to which you want to add Universal Login:

Update player settings

Before you continue to implement use Universal SDK APIs in your game, follow the steps below to make sure your project player setting is correct.

Settings for Android export

  1. Select File > Build Settings.

  2. Click Player Settings.

  3. Select Platform > Other Settings.

  4. Set Minimum API Level to at least API level 19.

  5. Set Target API Level to at least API level 31.

  6. Under Publishing Settings, enable Custom Gradle Template. (Move the .gradle files from 'Assets/UniversalSDK/Plugins/Android' to 'Assets/Plugins/Android'.)

Settings for iOS export

  1. Select File > Build Settings.

  2. Click Player Settings.

  3. Select Platform > Other Settings.

  4. Set Target minimum iOS Version to at least 11.0.

Implement login with Social

Now, you can implement login with Social in the scene where the UniversalSDK (GameObject) exists. For example:

using Universal.UniversalSDK;

public class LoginController : MonoBehaviour {
    public void OnClickExampleLogin()
    {
        UniversalSDK.Ins.Login(LoginType.GOOGLE)
            .OnSuccess(res =>
            {
                StartCoroutine(UpdateProfile(res));
                UpdateRawSection(res);
            })
            .OnError(err => UpdateRawSection(err));        
    }
}

Universal SDK for Unity supports only iOS and Android for now. It will always return an error if you run it in Unity Editor play mode. To test it, you need to export your scene to either an iOS or Android device.

If you are using CocoaPods as your dependency manager, after building the game to an Xcode project, open the Unity-iPhone.xcworkspace file instead of the original Unity-iPhone.xcodeproj.

Logout

During social login, only Android Google supports Logout. (Otherwise, the logout API is not supported.)

UniversalSDK.Ins.Logout();

ErrorCode

ErrorCodeDesc

CANCEL

7001

User Cancel

AUTHENTICATION_AGENT_ERROR

7002

authentication error

INTERNAL_ERROR

7003

Configuration error

Last updated