Installing the PDK for Unity3D

This guide is based on a new installation of the PDK and the PilloTemplate. To upgrade from an older version please see the upgrading manual

Set API compatibility to .NET 2.0

First thing you need to do is set the API compatibility to .NET 2.0. With a project open, go to Edit > Project settings > Player. This will open a new screen in the Inspector window. Click on the tab Other Settings to display the Api Compatibility Level option. This is (by default) set to .NET 2.0 Subset. Change this to .NET 2.0 Having trouble finding it? check this image.

Import the Pillo Development Kit

Import the Pillo Development Kit as you would with any third party Unity package. Go to Assets > Import Package > Custom Package and link to the PilloTemplate.unitypackage that is located in the PilloPDK\lib\UnityPackages folder of the PDK zip. Required for development is everything located in the _Core folder and all the required template tools are located in the folder PilloTemplate Additionally you can import the Assets and Examples folders if you wish to get the demo data.

Setting up the project

By importing the package you have already set up your project! In the folder PilloTemplate/Scenes you can find the scenes needed for basic setup. You can move the scenes to another folder if it is easier for you.

Do not forget to add the scenes into your build settings. Go to File→BuildSettings→AddOpenScene and add each of the Pillo scenes, ordering is not important.

GameScene is the scene where you need to program all the logic of your Pillo game, it already has 2 prefabs on the scene, ManagerSetup & UILoader, which are responsible for loading Template UI elements and other event managing settings. You are free to do what you want on the scene (only leaving those 2 prefabs), it will not affect the template.

MainUIScene is the scene which is loaded as a second scene whenever you play other scenes. It has the reference to each UI state and each screen state. It has one object MainUI which has children States, MainUI, MainUICamera and EventSystem. For more information about states and UI screens visit Screen States. MainUICamera is used to render Pillo UI from this scene.

MainMenuScene is similar to GameScene but has Pillo splash screen implemented. Screen states are responsible for loading wanted screens, so on this scene we get the background/header & main menu UI on top of the existing scene.

TutorialScene is the same as GameScene and has a reference in the main menu.

You can run the MainMenuScene and browse the menu, as well as, start the game which will lead you to another scene, whereas if you press Escape key you will see pause menu and will be able to go back to the menu.

Embed in your existing scripts (optional)

Alternatively you can choose to not import the Subscriber example in your scene, but instead use functions or add events to your existing game scripts.

To use the API's methods, use our API Method guide.

To use the Events in your existing scripts, first add the following two functions to the bottom of your script. You only need to Subscribe and Unsubscribe the methods you are going to use, but to be safe, and for testing purposes, it's easier and better to embed all methods.

private void SubscribeMethods()
    {
        PilloController.PilloConnected += OnPilloConnect;
        PilloController.PilloDisconnected += OnPilloDisconnect;
        PilloController.PilloPressed += OnPilloPressed;
        PilloController.PilloDown += OnPilloDown;
        PilloController.PilloReleased += OnPilloReleased;
        PilloController.PilloShaken += OnPilloShaken;
        PilloController.PilloGyro += OnPilloGyro;
    }

    private void UnSubscribeMethods()
    {
        PilloController.PilloConnected -= OnPilloConnect;
        PilloController.PilloDisconnected -= OnPilloDisconnect;
        PilloController.PilloPressed -= OnPilloPressed;
        PilloController.PilloDown -= OnPilloDown;
        PilloController.PilloReleased -= OnPilloReleased;
        PilloController.PilloShaken -= OnPilloShaken;
        PilloController.PilloGyro -= OnPilloGyro;
    }

After that, call the functions on Start and OnDestroy.

void Start()
    {
        //-- subscribe methods to broadcaster --//
        SubscribeMethods();
    }

    void OnDestroy()
    {
        //-- unsubscribe methods from broadcaster upon destruction of this. --//
        UnSubscribeMethods();
    }

After that insert the desired Event methods in your script.