Unity - API Interface

A guide on interfacing with the DTLab API through the Unity Editor in order to retrieve models and projects from the graphDB for use in Unity projects.

Server Integration Basics

Introduction

The Unity Server Integration package comprises three main components: LoginManager, LoginEditorWindow, and AuthTokenManager. Together, these scripts provide a solution for authenticating Unity users, fetching data from a server, and managing authentication tokens within the Unity Editor.

Key Functionalities

  1. User Authentication:

    • Users can input their username and password within the LoginEditorWindow.
    • Upon confirming, LoginManager sends the credentials to the server.
    • Successful authentication returns a token, stored using AuthTokenManager.
  2. Fetching Data:

    • Once authenticated, users can fetch models, projects, and their user data via buttons in the LoginEditorWindow.
    • The data retrieval is handled by LoginManager, which sends requests to the server using the token from AuthTokenManager.
    • Fetched data is displayed within the LoginEditorWindow.
  3. Token Management:

    • AuthTokenManager provides a centralized way to store and retrieve the authentication token.
    • The token is essential for making authenticated requests to the server after the initial login.

Workflow

  1. Open the LoginEditorWindow via Tools > Login Manager in the Unity Editor.
  2. Input your username and password, then click "Confirm".
  3. Upon successful login, the authentication token is stored.
  4. Use the "Fetch Models/Projects" and "Fetch User Data" buttons to retrieve data from the server.
  5. View the fetched data directly within the LoginEditorWindow.