m_test is null on OuyaSDK.requestPurchase [fixed]

JohnnyAlpha404JohnnyAlpha404 Posts: 8Member
edited July 2013 in Unity on OUYA
EDIT: Adding the OuyaGameObject in the current scene makes it work, it does however result in that prefab being in the scene twice once it has opened. Seems weird.

I'm stuck on this one. I'm trying to implement the IAP using the following code:

#pragma strict

public class Purchase extends MonoBehaviour implements
    OuyaSDK.IPurchaseListener,
    OuyaSDK.IPauseListener,
    OuyaSDK.IResumeListener,
    OuyaSDK.IMenuButtonUpListener,
    OuyaSDK.IMenuAppearingListener
{

private var input : InputHandlerPattern;

    private var failed : GameObject;
    private var canceled : GameObject;
    private var success : GameObject;
    public var bought : boolean = false;

    private var buy : GameObject;
    private var play : GameObject;

    function Awake(){
        OuyaSDK.registerPurchaseListener(this);
        OuyaSDK.registerMenuButtonUpListener(this);
        OuyaSDK.registerMenuAppearingListener(this);
        OuyaSDK.registerPauseListener(this);
        OuyaSDK.registerResumeListener(this);
        input = GetComponent("InputHandlerPattern") as InputHandlerPattern;
    }

    function Update(){
    if(input.pressed_A){
Application.LoadLevel("game");
}

if(input.pressed_O){
            if(!bought){
    OuyaSDK.requestPurchase("sbt_buy");
                failed.renderer.enabled = false;
                canceled.renderer.enabled = false;
            }
            else{
                PlayerPrefs.SetString("restart", "true");
                Application.LoadLevel("game");
            }
}
    }

    function OnDestroy(){
        OuyaSDK.unregisterPurchaseListener(this);
        OuyaSDK.unregisterMenuButtonUpListener(this);
        OuyaSDK.unregisterMenuAppearingListener(this);
        OuyaSDK.unregisterPauseListener(this);
        OuyaSDK.unregisterResumeListener(this);
    }

function OuyaPurchaseOnSuccess(product : OuyaSDK.Product){
Success();
}

function OuyaPurchaseOnFailure(errorCode : int, errorMessage : String){
failed.renderer.enabled = true;
}

function OuyaPurchaseOnCancel(){
        canceled.renderer.enabled = true;

    }
}


Whenever I press O I get the error in my Logcat that says:
requestPurchaseAsync sku: sbt_buy
OuyaUnityPlugin.requestPurchaseAsync: m_test is null

I'm using the latest unity 3.5.7 build, SDK Version 17, the ouya window says i'm running version 1.0.5.1 for the plugin, I've set my Developer ID and the Purchasables in the OuyaGameObject and added the purchase to my dev portal. I recall this working yesterday before I updated to the latest plugin version.

Is there anything here that I'm doing wrong and/or forgetting?

Follow up question:
How can I test this from within the Unity editor?
Post edited by JohnnyAlpha404 on
Public relations/Business side of Alpha404(web) and SassyBot Studio(game).
Check out our IGF nominee and other games at http://sassybot.com/games

Comments

Sign In or Register to comment.