OpenIAB不使用Unity3D

时间:2014-12-10 17:39:46

标签: android unity3d in-app-purchase

我在Unity3D的Android应用程序中包含OpenIAB插件,但是当我在设备上测试我的应用程序时,购买窗口不会被调用。哪里有问题??

void Start() {

    OpenIAB.mapSku (SKU, OpenIAB_Android.STORE_GOOGLE, "no_ads");
    var options = new OnePF.Options();
    options.checkInventory = false;
    options.verifyMode = OptionsVerifyMode.VERIFY_EVERYTHING;
    options.storeKeys.Add(OpenIAB_Android.STORE_GOOGLE, "My key");
    OpenIAB.init(options);


}
void OnGUI(){

    if (GUI.Button (new Rect (100, 100, 100, 100), "Push me")) {

        OpenIAB.purchaseProduct(SKU);
        GUI.TextArea(new Rect(200,200,150,150),"Its work!!!");

    }

}

private void OnPurchaseSucceded(Purchase purchase)
{


    if (purchase.Sku == SKU)
        GUI.TextArea(new Rect(150,150,150,150),"Good job!");


}

1 个答案:

答案 0 :(得分:0)

GUI功能仅适用于 OnGUI()调用。并且 GUI.TextArea(new Rect(200,200,150,150),“它的工作!!!”); 可能只是眨眼太快了。