# Scenes Loader

To use this system, inject ScenesLoader class into your class, as shown below:

```csharp
[Inject] private ScenesLoader scenesLoader;
```

### Parameters in inspector

**mainMenuSceneName** – main menu scene name. Scenes Loader will load this scene in case if you call **ToMainMenu()** method. Default value: **"MainMenuScene"**.

**loadingLabel** – TextMeshProUGUI text label on loading screen, where loading progress will be displayed.

**loadingBar** – Image of loading bar, which indicates scene loading progress.

**minLoadingTime** – minimal loading time in seconds; time delay between scenes will not be lesser than this amount. Default value: 2 seconds.

### Available methods

```csharp
void ToMainMenu()
```

*This method returns user to main menu scene. Scene loading process is asynchronous.*

***

```csharp
void LoadSceneAsync(string name)
```

*This method asynchronously loads scene with **name**.*

*Example:*

```csharp
scenesLoader.LoadSceneAsync("Level00");
```

***

```csharp
void LoadSceneAsync(string name, Action callback)
```

*This method asynchronously loads scene with **name** and invokes **callback** action afterwards.*

*Example:*

```csharp
scenesLoader.LoadSceneAsync(levelName, () => { uiController.ShowUIParts(UIPartType.InGameHUD); });
```

***

```csharp
bool IsSceneLoading()
```

*This method returns **true** if some scene is loading at the moment.*

***
