# Unity Remote Config Wrapper

{% hint style="danger" %}
*<mark style="color:red;">**Install**</mark>* <mark style="color:blue;">**Unity Remote Config**</mark> *package* in Package Manager before importing package below.
{% endhint %}

{% file src="<https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2FCYLbpm8ed87nbBHEoNNB%2FUnityRemoteConfig%20v2.1.unitypackage?alt=media&token=870439ca-71c2-4532-86e5-13fb66a3c95b>" %}
Package
{% endfile %}

***

Unity Remote Config requires Unity Services in order to work -> enable it.

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2FH8iZTwOplTneh07TqUts%2Fimage.png?alt=media&#x26;token=260f6297-d3f5-4ef1-a412-2bac3b8ae4f9" alt=""><figcaption><p>Services tab</p></figcaption></figure>

Select organization and Create project ID if you see the same window as above. \
Then toggle ads to "ON".

## Setup

Add variables in Unity dashboard remote config page,

Open RemoteConfig.cs and add variables to "Custom config variables".&#x20;

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2FrFH1pwcI5pQ4w6gcJLhG%2Fimage.png?alt=media&#x26;token=a318e3e7-6fd0-41a2-81a7-b5364fc84c91" alt=""><figcaption><p>Example of added variables</p></figcaption></figure>

Assign variables in AssignConfigParams() fuction.

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2FSdWgPY9SIUw4IWq8EMUb%2Fimage.png?alt=media&#x26;token=12c3cce8-93c6-44d9-ba83-c31ec42823c8" alt=""><figcaption><p>Hook info from Unity Remote Config for your declared variables</p></figcaption></figure>

Note that values in UnityRemoteConfig.prefab from inspector will be as default and after initialization of UnityServices they will updated to values from dashboard.

Initialization will be automatically done as soon as internet connection established RemoteConfig.cs checks for connection every N seconds underhood.

{% hint style="warning" %}
Add UnityRemoteConfig.prefab to your loader scene
{% endhint %}

Now you can use RemoteConfig.instance and get remote variables in other scripts.
