1. Home
  2. Docs
  3. UniREST Solution 3.5
  4. Getting Started
  5. Step by Step

Step by Step

The following guide will explain to you how to set up a working server environment and a working Unity project. Because there are a lot of details you should know, you will find links to the Manual chapters containing those details.


1. Install WordPress and UniREST Server plugin

The first thing to do is to have a working WordPress installation and install the UniREST Server WordPress plugin.

Click here for details…


2. Complete the UniREST Server setup

Once you have installed the UniREST Server plugin, you have to complete its setup. So, go to the UniREST Server application, click [OPEN] to start the application, then click [START] to complete the app configuration.

Click here for details…


3. Generate and copy the Client Config C# script

If you have successfully installed and set up the UniREST Server application, a green [CREATE CLIENT CONFIG] button will appear on the main page.

Click the button: a peace of C# code will be generated into a text area. Copy that text.

Click here for details…


4. Start a new Unity Project with UniREST Client

Go in Unity, start a new Unity Project (or open an existing project) and be sure to have the UniREST Client asset installed into it.

Click here for details…


5. Set up the UniRESTClientConfig.cs script

Open the UniRESTClientConfig.cs script in your code editor (Visual Studio or another editor) and paste there the Client Config script you copied in step 3.

Don’t modify this script. It contains what your Game needs for communicating with your Server.

Click here for details…


6. Create a new Scene

In your Unity Project, create a new Scene (or open an existing one). Then, create a new C# Script. Drag this script on a GameObject (for example, on the Main Camera) just to have it working when the Game Scene starts.


7. Set up the UniREST Client

Edit the C# Script. Import the TigerForge namespace:

using TigerForge;

In the Start() function, enable the UniREST Client debug mode. The code will be something like this:

using UnityEngine;
using TigerForge;
public class Test : MonoBehaviour
{
      void Start()    
      {
            UniRESTClient.debugMode = true;     
      }
}

Click here for details….


8. Login

You must log-in to the UniREST system if you want to do something. If you don’t log-in, the UniREST security system will block you.

The UniREST Client has different kinds of Login / Registration techniques. For this guide, we are going to use Login() method. You must have a user, with username and password, registered in your Users table (you can create a test account for this: more details).

Click here for details….

using UnityEngine;
using TigerForge;
public class Test : MonoBehaviour
{
      void Start()    
      {
            UniRESTClient.debugMode = true;

            _ = UniRESTClient.Async.Login("MyUser", "MyPass", (bool ok) =>
                {
                     if (ok) Debug.Log("I'm logged in!"); else Debug.LogError("Login failed!");
                });   
      }
}

9. Start the Game

Now start the Game and have look at the Unity Console. You should a result like this:

If you get a message like this one, it means that your Game and your Server are communicating without issues.