Prime31 Unity Plugins Officially Live! [CLOSED]

We are very proud to present our first 6 plugins for immediate use in your games. All our plugins are true Unity plugins that are designed to be dead simple to use. Setup takes just minutes so you can keep adding features to your games without any hassle. The first batch of plugins available for immediate download is:

  • iAd
  • Mobclix
  • DeviceMotion (Gyroscope support)
  • MediaPlayer (iPod audio support)
  • StoreKit (In App Purchasing)
  • CoreLocation (GPS location and compass)
    We have 2 more plugins in the final stages of testing and documenting: AudioRecording for easy access to the microphone and GameKit Bluetooth support. If you have any plugin requests, don’t hesitate to let us know and we will put it on our list. The more votes it gets, the higher up the list it goes. We appreciate any and all feedback so please don’t hesitate to contact us and let us know what’s on your mind.

Plugin Site
Documentation Site

Snagged a few of these. Thanks so much!

Please do post back and let me know if they were easy enough to use, the documentation made sense, examples were clear, etc.

Thanks!

So, the AudioRecorder plugin release had to be delayed due to Unity seemingly not having the ability to load an audio file from disk that was not included in the project file. We should all file feature requests to get this ability (unless I’m just really tired and missing something here). Well, the AudioRecorder plugin now has a brother that will be included in the package: AudioPlayer plugin. This will be a native audio player that can play files out of your documents directory or the standard iPhone bundle. I have to write double the docs now and test twice as much code but it should be ready by Sunday at the latest.

The GameKit plugin now has a demo and just needs some documentation and it is ready to go as well. More on this in the next couple days.

Good Work!

Could i suggest a video player plug-in?

We had a lot of problems with iOS 4 video playback and auto orientation !

Thank you.

Andrea

I’ll have to pick some of these up when my project nears completion…

Will these prices stay the same? Please say yes…haha.

How compatible is each of these with Open Feint? I ask becuase the other ad plugin does not work with OF…(I can’t get them to play together at least.)

These are all true plugins that don’t use AppController categories which means they are fully compatible with OpenFeint. You only run into problems with the PlayerPref hack-type plugins (that are not really plugins at all as defined by Unity).

To use any of these plugins with OpenFeint simply rename the OpenFeint PostprocessBuildPlayer to PostprocessBuildPlayer_OpenFeint and you are good to go.

Where is it in your StoreKit sample project I would change the product ID I set up in iTunes Connect? I am wondering if it is the StoreKitGUIManager.cs script where the line that reads:

string productIdentifiers = ā€œanotherProduct,t,testProductā€;

Is this correct? And if so what is the format I need to use? I know for a quick start, your customers would love for you to make a comment line explaining where to put in their information if they want to test the sample themselves quickly to see it work.

If this is not correct… where can I put in my Bundle ID and Product ID? And what is the format?

I am VERY EAGER to get this working as I have tried for months to get other solutions working to no avail.

@Logic Twilight, all the code in the StoreKitGUIManager.cs is examples of calling each of the StoreKit plugin functions. The productIdentifiers should be a list of the exact product ID’s you enter into iTunesConnect separated by commas. Your bundle ID goes in the normal Unity location in the Player Settings.

For the full documentation along with comments for each method check out the documentation page: StoreKit Documentation

I guess I need to be more specific in my question… is this the product ID WITHOUT the bundle identifier?

Basically what I would love an answer to is… How can I take your sample edit it to simply attempt to purchase a non-consimable single product ID?

I think your documentation lacks a simple explanation of where your scripts get the ā€œcom.MyCompanyName.ProductName.IAP_Product_IDā€ info from. In other words again, where is it I can edit the variable value in one central location (if your example does this) in your sample to make a simple purchase attempt?

I have already set up my IAP in iTunes Connect btw, and I was not referring to the bundle ID for the app in Unity… I was only referring to the variables that need to be edited in your sample that send the bundle ID and product name to the iTunes Store servers.

@Logic Twilight, the docs don’t go into much detail on the iTunesConnect side of things because Apple does an excellent job of that. ProductIdentifier’s are quite literally a copy/paste of the exact product ID you entered into iTunesConnect. Anytime the StoreKit plugin has a variable named productIdentifer it must be the exact one from there. The following image is the test application from iTunesConnect that is represented in the sample scene: image link

So, to purchase 1 of the first product in the image above it would simply be:

 StoreKitBinding.purchaseProduct( 'anotherProduct', 1 )

That’s all there is to it. The IAP sandbox server has been really shaky lately and quite slow to update. My test products often took over 24 hours before I could do test purchases on them. You also need to be certain that you always log out of your App Store account before testing IAP (Settings → Store → Sign Out). The docs have some good info that I got from an Apple rep as well with regard to testing. As suggested by the Apple rep, sometimes you have to reboot your phone as well to get the sandbox purchases to work.

I forgot to mention, ALWAYS watch the logs in the Xcode debugger. The plugins print some useful information in there so that you can figure out what your issues might be.

OK… you just cleared up a BIG thing… see, to someone who didn’t know you had 3 different products set up for your 1 app… it looks like you were referring to 3 different needed arguments like product name, qauntity and maybe some other needed argument… especially with the naming being ā€œAnother Productā€, then ā€œtā€ (looks like an Integer variable for quantity or something)… this totally threw me off. I suggest that you either make this clear in your script notation or better yet change this to ā€œProduct1, Product2, Product3ā€ or MANY customers will end up as confused as I was. I also suggest you make notes in your code that says ā€œ// PUT YOUR PRODUCT ID(s) HEREā€ where applicable with maybe an example line just below it like "// string productIdentifiers = ā€œProduct1,Product2,Product3ā€; I am actually VERY familiar with setting up IAP’s on Apple’s servers and have tried for months to get it working… maybe I was always hitting the reported Apple Server problems?

As for other feedback you would be interested in… your documentation for your plugins doesn’t give the developer any starting point and followed through instruction in many ways… I mean it needs to have somewhere in it instructions of where to start and how to continue making your solution work in their implementations. Throwing out just a list of method’s with argument explanations like Apple does is very confusing… it gives the user no direction as to where to start… what to copy and paste and where… without step by step instructions, its just like throwing a bunch of tinkertoys down for someone else to figure out. One thing Unity has in there documentation that is NEEDED by most non-super-advanced programmers is EXAMPLE CODE SAMPLES THAT JUST WORK ALREADY (with whatever needed changes outlined with simple instructions).

Prime31 can turn this ->ā€˜:cry:’ into this ->ā€˜:lol:’ … how?

I know most developers are going to use a simple single non-consumable one-time full upgrade… it might be very beneficial (I know it would have been for me) to make a sample project that simply…

1-Checks to see if this one-time upgrade purchase can be made from the device.
2-Reports a message if the purchase was ever made already for that app on that device.
3-IF NO PURCHASE WAS EVER MADE, then offers a button to make the purchase if it was not ever made on that device.
4-Shows the progress of the purchase attempt.

This was what I was hoping for when I heard about your plugin. If you can deliver such an example… I would love you FOREVER! MANY PEOPLE WILL LOVE YOU FOREVER!

OH WOW! I HAVE TO SAY I LOVE YOU!!! After clearing up the multiple product ID’s misunderstanding… I GOT IT TO WORK AND I LOVE YOU I LOVE YOU I LOVE YOU!

YOU HAVE JUST MADE ME A VERY HAPPY MAN DUDE!

YOU ROCK YOU ROCK YOU ROCK!

Everything worked perfectly! I totally am a satisfied Prime31 customer!

!!! PEOPLE, GET THIS PLUGIN MAKE SOME APPLE REVENUE FOR A CHANGE !!!

GREAT GOING PRIME31 !!! My clients will be very happy too! :smile: :lol:

AGAIN I LOVE YOU! (Actually I love everyone, BUT I LOVE YOU MORE!)

@Logic Twilight, the example you seek for the most part will be below. Hopefully it will turn :cry: into :lol:. The StoreKit plugin in particular is quite difficult to provide a drop in working example because it is so flexible, fully app specific and a good portion of the setup is in iTunesConnect. I leave the implementation details of creating a gui as an exercise to the user as it is quite game specific. The code may have a few errors because I am just typing it in untested but it should be really close. The code can be placed in Awake or Start or wherever else it makes sense for your game. It is well commented and illustrates the situation you asked for.

One caveat is that there is no way to show progress. All you can do is send off a request and wait for a response from Apple’s servers.

// Make sure the user can actually make payments before showing a buy now button
// If they can't, early out because we have nothing more to do here
if( !StoreKitBinding.canMakePayments() )
    return;

// Listen for the event when a user purchases a product successfully
StoreKitManager.purchaseSuccessful += onPurchaseSuccessful;

// Check for first launch and if it doesn't exist display a button
// and see if the user already bought this product
if( !PlayerPrefs.HasKey( "firstLaunch" ) )
{
      // Set the firstLaunch flag so that we only restoreCompletedTransactions once
      PlayerPrefs.SetInt( "firstLaunch", 1 );
      
     // This could be an existing user who reinstalled after a delete
     // so lets check to see if they bought this product.
     // This is async, so if the user bought anything the purchaseSuccessful
     // event will get triggered and we should give them the product at that time
     StoreKitBinding.restoreCompletedTransactions();

     // Show a buy now button in your gui that can be removed later if
     // you find that the user already bought this product
}

// This gets triggered when a user touches the Buy Now button
public void onTouchBuyNowButtion()
{
     // Kick off a product purchase because the user wants to buy this product
     StoreKitManager.purchaseProduct( "SOME_PRODUCT_ID_HERE", 1 );
}


// Callback for when a product is purchased
public void onPurchaseSuccessful( string productIdentifier, string receipt, int quantity )
{
      // Alright!  We got a sale!  Give them what they bought.
      // Hide the buy now button
}

READ THIS!!! - STOREKIT USERS !!!

Here’s an important thing I just found! Even if you are connecting just fine with Apple’s servers… if you try to purchase a Product ID that doesn’t exist (isn’t active and working in your In App Purchase settings)… Apple’s Server responds saying ā€œCannot connect to iTunes Storeā€! The way I found this is to make product 1 in your example correctly match my own real settings and to leave product 2 as you defined in your example (which doesn’t exist in my config)… when I purchase product 1… everything works fine… but when I try to purchase Product 2… it says it cannot connect every time!

I have tried getting IAP’s to work for many months and always got THE SAME ERROR MESSAGE… that it ā€œcannot connect to iTunes Storeā€! I have also talked to MANY other developers that GAVE UP because of the same error!.. I BET THIS IS THE MAIN PROBLEM EVERYONE IS HAVING!

Unfortunately I know nothing of C Sharp (Only JavaScript) and a straight copy paste just gave a parsing error in Unity (no other specific debugging clues). I then made sure to use the standard wrapper that Unity makes when creating a new script…

using UnityEngine;
using System.Collections;

public class IAPScript : MonoBehaviour {

	// Use this for initialization
	void Start () {

// Make sure the user can actually make payments before showing a buy now button 
// If they can't, early out because we have nothing more to do here 
if( !StoreKitBinding.canMakePayments() ) 
    return; 

// Listen for the event when a user purchases a product successfully 
StoreKitManager.purchaseSuccessful += onPurchaseSuccessful; 

// Check for first launch and if it doesn't exist display a button 
// and see if the user already bought this product 
if( !PlayerPrefs.HasKey( "firstLaunch" ) ) 
{ 
      // Set the firstLaunch flag so that we only restoreCompletedTransactions once 
      PlayerPrefs.SetInt( "firstLaunch", 1 ); 
      
     // This could be an existing user who reinstalled after a delete 
     // so lets check to see if they bought this product. 
     // This is async, so if the user bought anything the purchaseSuccessful 
     // event will get triggered and we should give them the product at that time 
     StoreKitBinding.restoreCompletedTransactions(); 

     // Show a buy now button in your gui that can be removed later if 
     // you find that the user already bought this product 
} 

// This gets triggered when a user touches the Buy Now button 
public void onTouchBuyNowButtion() 
{ 
     // Kick off a product purchase because the user wants to buy this product 
     StoreKitManager.purchaseProduct( "SOME_PRODUCT_ID_HERE", 1 ); 
} 


// Callback for when a product is purchased 
public void onPurchaseSuccessful( string productIdentifier, string receipt, int quantity ) 
{ 
      // Alright!  We got a sale!  Give them what they bought. 
      // Hide the buy now button 
} 




	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

with this I got these errors…

Assets/Editor/IAPScript.cs(35,6): error CS1525: Unexpected symbol `public’

Assets/Editor/IAPScript.cs(19,1): warning CS0642: Possible mistaken empty statement

Assets/Editor/IAPScript.cs(56,14): error CS0116: A namespace can only contain types and namespace declarations

and yet another parsing error reported as:

Assets/Editor/IAPScript.cs(59,1): error CS8025: Parsing error

Can we get a corrected script if it’s not too much to ask?

Is it possible to have a JavaScript example?

Again, I LOVE YOU!

I don’t use UnityScript (JavaScript) at all in Unity so unfortunately I can’t convert the script easily. I can read UnityScript just find but the I don’t know the syntax for nuances such as events and other .NET/Mono features. Here is a working C# script though:

using UnityEngine; 
using System.Collections; 


public class IAPScript : MonoBehaviour
{ 

   	// Use this for initialization 
	void Start()
	{
		// Make sure the user can actually make payments before showing a buy now button
		// If they can't, early out because we have nothing more to do here
		if( !StoreKitBinding.canMakePayments() )
		    return;

		// Listen for the event when a user purchases a product successfully 
		StoreKitManager.purchaseSuccessful += onPurchaseSuccessful;

		// Check for first launch and if it doesn't exist display a button 
		// and see if the user already bought this product 
		if( !PlayerPrefs.HasKey( "firstLaunch" ) )
		{
		      // Set the firstLaunch flag so that we only restoreCompletedTransactions once
		      PlayerPrefs.SetInt( "firstLaunch", 1 );

		     // This could be an existing user who reinstalled after a delete
		     // so lets check to see if they bought this product.
		     // This is async, so if the user bought anything the purchaseSuccessful
		     // event will get triggered and we should give them the product at that time
		     StoreKitBinding.restoreCompletedTransactions();
			
		     // Show a buy now button in your gui that can be removed later if 
		     // you find that the user already bought this product 
		}
	}
	
	
	// This gets triggered when a user touches the Buy Now button
	public void onTouchBuyNowButtion()
	{
	     // Kick off a product purchase because the user wants to buy this product
	     StoreKitBinding.purchaseProduct( "SOME_PRODUCT_ID_HERE", 1 );
	}
	

	// Callback for when a product is purchased 
	public void onPurchaseSuccessful( string productIdentifier, string receipt, int quantity )
	{
	      // Alright!  We got a sale!  Give them what they bought.
	      // Hide the buy now button
	}
}

Uprise, include some sort of volume level detection (maybe even pitch, etc.) if that’s possible. :slight_smile:

Again, You Rock… the all in one single purchase script worked! Thank you for all your help… you really came through for us! :stuck_out_tongue: