Coder Social home page Coder Social logo

unity-sdk's Introduction

LootLocker Unity SDK

LootLocker

AboutInstallationConfigurationUpdatingSupportDevelopment


About

LootLocker is a game backend-as-a-service that unlocks cross-platform systems so you can build, ship, and run your best games.

Full documentation is available here https://docs.lootlocker.com/

Installation

From Open UPM openupm

The preferred way of installing the LootLocker SDK is through Open UPM. This way you will receive future updates in a streamlined way. Please refer to OpenUPM for their simple install instructions or our official documentation.

From Git

Before you start you need to have git installed on your computer.

  • In the Unity Editor go to Window > Package Manager
  • Click the + at the top left of the Package Manager window
  • Select Add package from git URL...
  • Paste the following URL https://github.com/LootLocker/unity-sdk.git and click Add

Other install methods

For other methods, please refer to our official documentation.

Configuration

For a full walkthrough of how to configure the SDK, please see our Guide to Configuring the Unity SDK. But here's a short explanation:

Using the LootLocker Unity Extension (since Unity v2021)

  • Open the LootLocker Extension in Unity (Windows > LootLocker)
  • Sign in with your LootLocker account
  • Select your game, environment, and game key.

Configuring the SDK manually

Updating

If you have installed the SDK from Open UPM then all you have to do in Package Manager is press the Update button when that tells you there's a new version.

For other install methods and more information, head over to our official documentation.

Support

If you have any issues or just wanna chat you can reach us on our Discord Server

Development

Testing the SDK

Status: Test SDK with Unity

There is a Test Suite for the SDK, but it is in an external repo to keep the size of this one down. It is run automatically on any pull requests towards or updates to main. You can also run it locally, just follow the steps in the test repo.

unity-sdk's People

Contributors

almightymikkel avatar andreasstokholm avatar bottosson avatar eomene avatar johannesloot avatar kirre-bylund avatar kristijan-ujevic avatar mickeygeecom avatar tobiasberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

unity-sdk's Issues

The object of type 'LootLockerServerManager' has been destroyed but you are still trying to access ...

I get this error after running the example code given on the documentation with Unity 2021.3.4f1 LTS. Sometimes it goes away after waiting a while before hitting the play button again.

The object of type 'LootLockerServerManager' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.

EDIT: The fix is to disable "Editor Play Mode"

@johannes

I've tried my best to reproduce this, but still haven't found what it is that causes it unfortunately.
The only way I can get this to happen is by either manually destroying the ServerManager or if Enter Play Mode Options are enabled.
Do you have Enter Play Mode Options enabled?
It's located in Project Settings -> Editor -> Enter Play Mode Options

Importing into Unity2021.3.22f1 causes Compiler Errors: Namespace Netwonsoft could not be found

I just upgraded to Unity 2021.3.9f1 to 2021.3.22f1 and had suddenly a lot of compile errors in LootLocker. The same happened when importing LootLocker from the Asset Store into my project:

grafik

It seems the Newtonsoft-Library is no longer available in Unity, it should be supplied with your project.

To reproduce:

  1. Create a new project in Unity 2021.3.22f1.
  2. Import LootLocker from the Asset Store

Can you give me a workaround?

Submit Score not sending score with request

I notice the following errors occasionally in my console log. I'm passing the score with the request. Notice how the request body doesn't show the score, just a member_id.

ServerRequest POST URL: https://wt5cbcoj.api.lootlocker.io/game/leaderboards/Easy/submit
UnityEngine.Debug:Log (object)
LootLocker.LootLockerBaseServerAPI/<>c__DisplayClass8_0/<g__coroutine|0>d:MoveNext () (at Assets/LootLockerSDK/Runtime/Client/LootLockerBaseServerAPI.cs:74)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

REQUEST BODY = {"member_id":"mymemberid"}
UnityEngine.Debug:Log (object)
LootLocker.LootLockerBaseServerAPI:CreateWebRequest (string,LootLocker.LootLockerServerRequest) (at Assets/LootLockerSDK/Runtime/Client/LootLockerBaseServerAPI.cs:297)
LootLocker.LootLockerBaseServerAPI/<>c__DisplayClass8_0/<g__coroutine|0>d:MoveNext () (at Assets/LootLockerSDK/Runtime/Client/LootLockerBaseServerAPI.cs:77)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

Server Response: 400 leaderboards/Easy/submit completed in 0.0000 secs.
Response: {"error":"Bad Request","message":"score is required in input","request_id":"9a811fcf-387d-4b4e-8fb9-97f25ad21b62","trace_id":"6ecf1f1a3a8f38eec436369ee32e81bd"}
UnityEngine.Debug:Log (object)
LootLocker.LootLockerBaseServerAPI/<>c__DisplayClass8_0/<g__coroutine|0>d:MoveNext () (at Assets/LootLockerSDK/Runtime/Client/LootLockerBaseServerAPI.cs:107)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

It's not a showstopper. And it doesn't happen very often.

Update 2023-06-19: It looks like a score of 0 causes this issue.

v 1.2.1 Build Issue - Unity Windows Application

I'm integrating the SDK into my Unity game. When I switched build settings to Windows, and tried to build the application, I got the error below.

Unity.Plastic was not found.

I had to modify the file, LootLockerSDK/Runtime/Editor/AttributionHandler.cs, to fix it. I moved the using statement inside the #if definition.

Here is an image of what I did.

image

Missing Reference Exception's with Domain Reload disabled

When following the tutorial for Guest Login, out-of-the-box LootLocker will throw errors if you're running Unity with domain reload disabled.

It would be great if the SDK cleared its static references on exiting play mode.
I got around this by calling LootLockerServerManager.CheckInit(); on Start before making an API call, but it would be fantastic if this was not necessary.

To replicate:

  • Install SDK into a fresh project
  • Unity > Edit > Project Settings > Editor > Enter Play Mode Options checked, uncheck Reload Domain, and uncheck Reload Scene
  • Place script that calls SDK on a GameObject i.e.
        LootLockerSDKManager.StartGuestSession((response) =>
        {
                Debug.Log(response.success);
        });
  • Run. (No error, API call works)
  • Exit play mode.
  • Run. Error occurs. MissingReferenceException: The object of type 'LootLockerServerManager' has been destroyed but you are still trying to access it.

This should be quite easy to fix (see: RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration))

UnityWebRequest timeout handling incorrect

https://github.com/LootLocker/unity-sdk/blob/dd86f336337657eaad4c94cf98fb3b14e86479cf/Runtime/Client/LootLockerBaseServerAPI.cs#L81-L85

When LootLockerBaseServerAPI calls yield return webRequest.SendWebRequest(); this will not re-enter the co-routine until the request has completed. This means that the following loop that checks for a timeout value is never entered. The value of webRequest.isDone will always be true.

Timeouts (eg, in the event of a network disconnect) do still occur, but are timed by the system TCP timeouts, and not controlled by the game code.

Not an urgent issue, just something I noticed while debugging recently.

Persistent Player Storage - Not Implemented?

Hi, I want to make use of the Persistent Player Storage, but I can't seem to find any implementation in the SDK. I'd rather not make use of webrequests at this point, since everything is called via the SDKManager at the moment. I do, however, am able to fetch the entire persistent storage, but I would also like to add/edit storage for the currently logged in player. :)

Is there an ETA for when this feature gets implemented in the SDK?

p.s. Love the work you guys have put into the SDK so far, keep it coming :)

MacFsWatcher not found

After pulling the SDK into a Unity 2023 project I get this error:

Library\PackageCache\com.lootlocker.lootlockersdk@fb06a58130\Runtime\Game\Requests\HeroRequest.cs(4,7): error CS0246: The type or namespace name 'MacFsWatcher' could not be found (are you missing a using directive or an assembly reference?)

Init error with WebGL

The package doesn't seem to be able to initialize properly when the game is build with WebGL.

I get the following error: https://xxxxx.api.lootlocker.io/game/v2/session/guest 400 (Bad Request)
I've tried calling LootLockerSDKManager.Init() with the hardcoded parameters to check if it was due to some kind of env variables not being set in WebGL but the results is the same.

Note that everything is okay in the Windows build.

Trying to fetch Assets on Android causes a runtime error

When using the function LootLockerSDKManager.GetAssetListWithCount() on an Android device, there will be a runtime error when receiving the response.

There is a workaround that you can do that does not impact anything in your game, it is just some more steps to setup.

Workaround

  1. Go to Window -> Package manager, click the plus-sign in the top-left corner, "Add package by name"
  2. Paste this; com.unity.nuget.newtonsoft-json
  3. Click Add
  4. Wait for the package to install
  5. Go to Project Settings -> Player -> scroll down to Scripting Define Symbols and add LOOTLOCKER_USE_NEWTONSOFTJSON
  6. All done!

Note: If you already have NewtonSoft installed in your project, you can skip step 1 to 4.

We are aware of this issue and are working on a solution.

Serialization issue in 1.2.0

Looks like the new serialization library you guys are using is not serializing Player Storage payload correctly, might be the case with other features too.

1.2.0
image

1.1.47
image

So I had to rollback to 1.1.47 again 😞

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.