Search Results for

    Getting Started

    Install

    1. In Unity, open the Package Manager by opening Window/Package Manager
    2. Then click on the + button on the upper-left-hand corner of the Package Manager, select "Add package from git URL..." on the context menu, then paste the following: https://github.com/thehen/unlock-unity-package.git?path=/Unlock%20Unity%20Package

    addpackage

    1. Now setup Unlock Protocol by selecting Unlock Protocol/Setup Unlock Protocol.

    setup

    1. Set your build platform by opening File/Build Settings and under Platform, selecting WebGL.

    webgltemplate

    1. Finally, open up Edit/Project Settings/Player and under the Resolution and Presentation dropdown, select the Unlock-paywall WebGL Template.

    webgltemplate

    Adding the Paywall to a new Scene

    1.) Create a new Unity scene and open it up.

    2.) Create a Lock config file by selecting Assets/Create/Unlock/Lock Config

    3.) Select the Lock config file and fill in the lock details as follows.

    Name: Unity Plugin Demo

    Network: 5

    Address 0x2816d7651231ae260a7f39fdefbf0d64a8f5fbdb

    lockconfig

    4.) Create a Paywall config file by selecting Assets/Create/Unlock/Paywall Config.

    5.) Select the Paywall config file and add your Lock config file to the Lock Configs:

    lockconfigs

    6.) Add a UI Canvas and a Button by selecting GameObject/UI/Legacy/Button.

    7.) We now need to create the Unlock Paywall Manager. Create a new GameObject by selecting GameObject/Create Empty and add an UnlockPaywall component to it and set the parameters to match the following:

    paywall

    8.) Select the button you added before, and set the OnClick event to the following:

    btnclick

    9.) Select File/Build Settings, ensure your build target is WebGL, and press Build and Run to test the scene.

    You should be presented with an empty scene and a button. Upon pressing the button, the payment flow will begin. After succesful payment, the button should then disappear.

    In This Article
    Back to top Unlock Protocol for Unity