# AppStart

{% hint style="info" %}
In **BeforeSplashScreenAppear** method implemented [Version validation](https://reddycat.gitbook.io/base-project-cube-doc/fundamentals/versionvalidator), which checks for game version update and fits user save data between major game updates.
{% endhint %}

{% hint style="success" %}
SplashScreen logic is also here. You can implement and call your custom.\
[**VersionValidator**](https://reddycat.gitbook.io/base-project-cube-doc/fundamentals/versionvalidator) is called before default splash screen logic.
{% endhint %}

{% hint style="warning" %}
Setup for mobile devices vSync and target frame rate defined also in AppStart:

```csharp
var graphicsSettings = saveSystem.GameSettings.GraphicsSettings;
QualitySettings.vSyncCount = graphicsSettings.VSyncCount;
Application.targetFrameRate = graphicsSettings.TargetFrameRate;
```

To change this settings it's recommended to implement settings change in-game UI and change GameSettings.GraphicsSettings.TargetFrameRate and vSync.
{% endhint %}

## DontDestroyOnLoad systems initialization in Loader scene

Replace all systems that you need to initialize before game scene load under Systems disabled object.\
That way systems will get the most fresh SaveData object (after validation and remote save load if there is):

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2FfwM0jnS84Q4JOgMoVJ08%2Fimage.png?alt=media&#x26;token=bb114960-85b8-4d34-944c-311ca8eb40d0" alt=""><figcaption><p>Systems disabled object for all systems that should be inited after save data ready</p></figcaption></figure>

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2FWWGnzAXxTZMzVJ1sQgaf%2Fimage.png?alt=media&#x26;token=32dc13f1-50a4-403c-a1bb-5df86f229cc8" alt=""><figcaption><p>Default systems that already in Systems holder</p></figcaption></figure>

AppStart.cs will trigger all systems after version validation (also remote save load can be).\
All objects replaced under disabled object "*Systems*" should be in active state. \
AppStart.cs will unparent them as soon as save data will be ready. \
By unparenting all objects under Systems all unparented objects will invoke Awake and Start methods (if there is).

## Unity logs in build

{% hint style="danger" %}
By **default** unity logs *<mark style="color:red;">**disabled**</mark>* in build by <mark style="color:blue;">**AppStart.cs**</mark>! \
So if you need to debug something in build -> comment highlighted lines below.\
\&#xNAN;*And don't forget to uncomment it back before release for optimizations!*
{% endhint %}

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2FIGaVtH1JUwWqFKnBbzxI%2Fimage.png?alt=media&#x26;token=662684de-9e35-4d86-b01e-572ff6fbb361" alt=""><figcaption><p>comment highlighted lines to enable logs in build</p></figcaption></figure>
