so i’ve watched the five minute video you guys posted on how to get in app purchases to work and i THINK i’ve got it all incorporated into my in app purchase GUI Button script . But heres my question say i have an IAP for 100 coins. in my if (GUI.Button … ) bit i have
IAPXT.Buy(coinsProductID, 100); how then do i move those coins from there to the players wallet? do i just go
if (GUI.Button(new Rect(row1,coll1,iconSize.x,iconSize.y),purchase1,noGuiStyle))
{
IAPXT.Buy(coinsProductID, 100);
currentCoins = currentCoins + 100;
}
because i feel like that would give the player coins successful purchase or not. any help you guys can offer would be GREATLY appreciated.
u3dxt
July 1, 2014, 7:26am
2
Please take a look at the sample code here: http://unity3d.tutsmobile.com/5-minute-guide-to-inapp-purchases-for-ios/
The highlight is the subscribe events function, specifically:
IAPXT.TransactionCompleted += delegate(object sender, TransactionEventArgs e) {
Log("TransactionCompleted: " + e.productID + ", " + e.quantity);
// add the coins here
};
You may also want to handle the TransactionFailed delegate by showing a message to the player.
so could i do something like `
coinsProductID
IAPXT.TransactionCompleted += delegate(object sender, TransactionEventArgs e) {
Log("TransactionCompleted: " + e.productID + ", " + e.quantity);
if ( e.productID == coinsProductID)
{
currentCoins = currentCoins + 100;
} else if ( e.productID == coins2ProductID)(
)
};
and so on? sorry I’m sure this is crazy simple i just can’t seem to crack it. i really appreciate the help tho.