Server Integration Basics
Introduction
The Unity Server Integration suite comprises three main components: LoginManager, LoginEditorWindow, and AuthTokenManager. Together, these scripts provide a comprehensive solution for authenticating Unity users, fetching data from a server, and managing authentication tokens within the Unity Editor.
-
LoginManager: Responsible for interfacing directly with the server. It sends login credentials, retrieves user data, models, and projects.
-
LoginEditorWindow: Provides a user-friendly GUI within the Unity Editor for users to input their credentials, initiate server requests, and view fetched data.
-
AuthTokenManager: A utility class that centrally manages the authentication token, ensuring secure storage and easy access for server requests.
Key Functionalities
-
User Authentication:
- Users can input their
usernameandpasswordwithin theLoginEditorWindow. - Upon confirming,
LoginManagersends the credentials to the server. - Successful authentication returns a token, stored using
AuthTokenManager.
- Users can input their
-
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 fromAuthTokenManager. - Fetched data is displayed within the
LoginEditorWindow.
- Once authenticated, users can fetch models, projects, and their user data via buttons in the
-
Token Management:
-
AuthTokenManagerprovides 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
- Open the
LoginEditorWindowviaTools > Login Managerin the Unity Editor. - Input your
usernameandpassword, then click "Confirm". - Upon successful login, the authentication token is stored.
- Use the "Fetch Models/Projects" and "Fetch User Data" buttons to retrieve data from the server.
- View the fetched data directly within the
LoginEditorWindow.