1. Home
  2. Docs
  3. UniREST Solution 3.5
  4. UniREST Client
  5. UniREST Client Config

UniREST Client Config

Client Config Set-up

The first thing to do is to correctly set up the UniREST Client Configuration. It’s pretty simple and requires just 2 steps:

  1. in the UniREST Server application home page, click the [CREATE CLIENT CONFIG] button and copy the C# Script;
  2. in your Unity game, open the UniRESTClientConfig.cs file in your development editor (i.e. Visual Studio) and paste the C# Script (if you are updating the client configuration, just replace the current script with this new one).

The Client Config Script structure

This script consist of 3 system classes: UniRESTClientConfig, API and DB. Those classes are used by the UniREST system and shouldn’t be modified.

UniRESTClientConfig class
This class contains the secret Keys for the encrypted communications and the base HTTP URL where the UniREST API Engine is active and working.

The UnREST 2.0 version introduces a new REST API engine. For this reason, the C# code contains two ServerUrl variables. The enabled variable points to the new API engine, while the second commented variable points to the old engine.

API class
This class is the collection of all the APIs created with the UniREST Server application. Basically, each API address is stored into a string variable, which name consists of the API Group name and the API name separated by an underscore.
For example, if your API is http://mysite.com/wp-json/api/v2/player/data, this address will be available just as API.player_data.

DB class
This class contains all the Database tables in the form of classes, which properties correspond to the table columns, with the same data-type.

For example, if you have created a table named Player like this one:

Column nameMySQL Data-type
idbigint(20)
nametext
healthint(11)
strengthfloat
creation_datedatetime

the DB class will contain a Player class that replicates this table structure:

public class Player
{
  public int id = 0;
  public string name = “”;
  public int health = 0;
  public float strength = 0;
  public string creation_date = “”;
}

In this way, when you have the need for performing some operation on the Player table, you can use an instance of DB.Player.