> For the complete documentation index, see [llms.txt](https://bizachi-dev.gitbook.io/bullethell-elemental-template/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bizachi-dev.gitbook.io/bullethell-elemental-template/user-interface-menus/editor.md).

# Login Scene

The Login scene is the entry point of the template. It signs the player in and holds every manager the other scenes use.

`BulletHellTemplate/Res/Scenes/Login.unity` must be the **first scene** in Build Settings, and it is the scene you press Play from. The managers it holds are marked `DontDestroyOnLoad`, so they stay alive in Home and in every map.

<figure><img src="https://215355839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fc8AVbPtcUOjcVrQx9Eyu%2Fuploads%2Fgit-blob-a5412de02026798b72bcc78dba8586680efb36c4%2Fgame-login.jpg?alt=media" alt="Login screen"><figcaption><p>The login screen. The version text at the bottom shows the build version and the active backend.</p></figcaption></figure>

***

### 1. Hierarchy

<figure><img src="https://215355839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fc8AVbPtcUOjcVrQx9Eyu%2Fuploads%2Fgit-blob-42a50dfcc2d89778402abd0f1a5a8c7817f68393%2Fv16-login-hierarchy.png?alt=media" alt="Login scene hierarchy"><figcaption><p>The Login scene. The objects with dashes are separators and do nothing.</p></figcaption></figure>

| Object                         | Components                                                                    | Purpose                                                                                                                                                                                                            |
| ------------------------------ | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Canvas > AuthManagerUI**     | AuthManager, AuthScreenView                                                   | Login and create account forms, guest button, ban screen, language dropdown. Prefab: `Core/UIElements/AuthManagerUI.prefab`.                                                                                       |
| **GameInstance**               | GameInstance, MonetizationManager, BattlePassManager, GameManager, IAPManager | All the game data (characters, items, maps, quests, shop...), currencies, battle pass, scene flow and in-app purchases. See [Game Instance](/bullethell-elemental-template/user-interface-menus/game-instance.md). |
| **LanguageManager**            | LanguageManager                                                               | Translations and fonts for each language. See [Language Manager](/bullethell-elemental-template/user-interface-menus/language-manager.md).                                                                         |
| **AudioManager**               | AudioManager                                                                  | Volumes and audio playback. See [Audio Manager](/bullethell-elemental-template/user-interface-menus/audio-manager.md).                                                                                             |
| **MapRewardManager**           | RewardManagerPopup                                                            | Tracks first-clear map rewards and PvP win rewards. See [Reward Manager Popup](/bullethell-elemental-template/user-interface-menus/reward-manager-popup.md).                                                       |
| **BackendBootstrap**           | Backend Lifetime Scope                                                        | Chooses the backend (Offline, Firebase or WebSocket) from a Backend Settings asset.                                                                                                                                |
| **BackendManager**             | BackendManager                                                                | Gives the rest of the game access to the chosen backend. See [Backend Manager](/bullethell-elemental-template/user-interface-menus/backend-manager.md).                                                            |
| **PhotonFusionNetworkManager** | FusionLobbyManager                                                            | Online rooms, parties, matchmaking and bots. See [Multiplayer](/bullethell-elemental-template/getting-started/multiplayer-photon-fusion-2.md).                                                                     |
| **LoadingManager**             | LoadingManager (+ UILoading with LoadingScreenView)                           | Loading screen between scenes. See [Loading Manager](/bullethell-elemental-template/user-interface-menus/loading-manager.md).                                                                                      |
| **LoginAmbientAudio**          | SceneAmbientAudio                                                             | Music of this scene.                                                                                                                                                                                               |
| **EventSystem**                | EventSystem, InputSystemUIInputModule                                         | UI input (new Input System).                                                                                                                                                                                       |

***

### 2. Typical flow

1. **BackendBootstrap** reads its Backend Settings asset and creates the selected backend.
2. **AuthManager** shows "Initializing backend" and waits for it.
3. If a session is saved (or with the Offline backend, always) the player is logged in automatically and the **Home** scene loads behind the loading screen.
4. Otherwise the login form is shown. A banned account sees the ban screen with the reason and duration.

With an online backend, the local cache is cleared at login and the account is loaded from the server.

***

### 3. Login screen settings

<figure><img src="https://215355839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fc8AVbPtcUOjcVrQx9Eyu%2Fuploads%2Fgit-blob-8f91601ca7a8215d1f251b528e6ce6618e522978%2Fv16-auth-manager.png?alt=media" alt="Auth Manager in the Inspector"><figcaption></figcaption></figure>

The login screen is the `AuthManagerUI` prefab (`Core/UIElements`). Its **Auth Manager** component has the fields you may need:

* **Home Scene Name**: scene loaded after a successful login (`Home`).
* **Error messages** (Invalid Email Error, Password Too Short Error and the others): the text of each error, per language.

Its **Auth Screen View** component has two lists that matter when you change backend: **Hide When Offline** (the email and password fields, the login button) and **Show When Offline** (the note under the guest button), because the Offline backend has no accounts.

***

### 4. Tips

{% hint style="info" %}
The password rules are checked on the create account form, by Firebase and by the WebSocket server. Change them in one place only: **Game Instance > Authentication Settings**. For the WebSocket server, export the data again afterwards.
{% endhint %}

* **Do not delete or duplicate the managers.** Most scripts expect exactly one of each. A second GameInstance destroys itself.
* To change the look of the login screen, edit the `AuthManagerUI` prefab, not the scene instance.
* Every text on this screen has translations. See [Language Manager](/bullethell-elemental-template/user-interface-menus/language-manager.md) before replacing a text component.
* When you add your own global manager, put it in this scene and call `DontDestroyOnLoad` on it, like the others.
