Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Prime31 Unity Plugins Officially Live! [CLOSED]

Discussion in 'iOS and tvOS' started by prime31, Aug 27, 2010.

Thread Status:
Not open for further replies.
  1. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @teamcobby, what you will want to do is just listen to the adViewDidChange event. When it returns false, show the AdMob banner. The *EventListener script has an example of how to listen to events and we also have a video tutorial on events here:
     
  2. teamcobby

    teamcobby

    Joined:
    Jan 18, 2012
    Posts:
    15
    Thanks prime31. So I guess, instead of using the prefab adMob, I should use the script to create the adMob banner when iAd fail, assuming the adMob banner will be drawn on top of the iAd banner. Then if iAd return success, i will destroy the adMob banner.
     
  3. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @team, right. Prefabs won't help you for a custom situation like this. You will have to call the create/destroy methods on your own.
     
  4. lastprogrammer

    lastprogrammer

    Joined:
    Apr 30, 2011
    Posts:
    166
    Hi, I am asking this in regards to your multiplayer game center plugin. When the players connect, does the network views and Network.Instantiate() commands work too, or do I have to start a server using unity commands?
     
    Last edited: Jan 19, 2012
  5. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @thelastprogrammer, the GameCenter Multiplayer Plugin has nothing to do with Unity networking. You would use either GameCenter Multiplayer or Unity networking but never both at the same time.
     
  6. lastprogrammer

    lastprogrammer

    Joined:
    Apr 30, 2011
    Posts:
    166
    Thanks for your answer.

    So if I call your method:

    Code (csharp):
    1. public static void disconnectFromMatch();
    Then I would be allowed to use the unity networking commands?
     
  7. Risine

    Risine

    Joined:
    Dec 10, 2009
    Posts:
    154
    Hi,

    I'm posting a message on facebook, and it works fine,, except that it's adding a message I don't want and coming from 'nowhere' ( not from me at least ) saying :
    "Connecting to the iTunes Store."

    Just below my caption text.
    Is it normal?
     
  8. mathiassoeholm

    mathiassoeholm

    Joined:
    Jul 20, 2010
    Posts:
    104
    Hey Prime31

    Thanks for your help, everything is working fine now :)
     
  9. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @thelast, you will want to either use Unity networking or GameCenter Multiplayer. I can't imagine why you would want to use both at once.


    @Risine, that is not at all normal. Can you post a screenshot along with the code you used to post?
     
  10. 10001110101

    10001110101

    Joined:
    Jan 19, 2012
    Posts:
    9
    Dearest Prime31 developers,

    I seem to be having a linking error when using the Native Toolbox plugin.
    The error is:
    duplicate symbol _jpeg_CreateCompress

    I've also noticed that the plugin doesn't play nice with Plists and Prefixed Header files.
    What files should I not be adding into the Native Toolbox folder when I use the plugin?

    Thanks for being awesome to your supporters.

    -T
     
  11. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @10001110101, _jpeg_CreateCompress isn't something that Native Toolkit provides. Double check your other files and perhaps try doing a Build followed by Replace to get a fresh package.
     
  12. teamcobby

    teamcobby

    Joined:
    Jan 18, 2012
    Posts:
    15
    Hi, prime31. A separate question on the call sequence with Tapjoy offer wall. I have trouble retrieving and spending tap points. The way I did is to put the following inside a GUI.Button:

    Case 1:

    OnGUI:
    if (GUI.Button...) {
    TapjoyBinding.init
    TapjoyBinding.showOffers();
    }

    then listen to

    void tapPointsReceived(int totalPoints) {
    if (totalPoints > 0) {
    TapjoyBinding.spendTapPoints(totalPoints);
    gamepoint += totalPoints;
    }

    the result is that it credit 5 times or more tappoints than the user earned. Say, the user earn 60 points, then a pop up will be displayed 5 times, giving the user 300 points.

    Case 2:
    I tried putting the TapjoyBinding.init in the Awake method, but the tapPointsReceived() won't be triggered until the next time the user start the game.

    Ideally, the tapPointsReceived should be called after the user clicked on an offer... Or is case 2, the correct sequence?
     
  13. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @cobby, you most definitely don't want to call init every time a button is pressed. It only needs to be called once preferably at app launch. If I recall tap points earned ate only reported at app launch by Tapjoy but to be 100% certain you will want to double check their docs.
     
  14. lastprogrammer

    lastprogrammer

    Joined:
    Apr 30, 2011
    Posts:
    166
    Sorry to sound like such a noob, but I'm just not familiar with byte arrays. I see in your examples that you have:

    Code (csharp):
    1. var bytes = System.Text.UTF8Encoding.UTF8.GetBytes( theStr );
    Are there commands to turn Vector3 into a byte? I would like to update the player's position to all connected players.

    Thanks.
     
  15. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @thelastprogrammer, if you arent comfortable with byte arrays I would recommend using the standard string methods and just serializing/deserializing string interpretations of them.
     
  16. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    Hey all,

    I've seen this answered a few time in this lengthy forum post, however none of the answers have yet addressed this problem for me. I have incorporated the Etcetera plugin, version December-16th, to a project in Unity 3.5b (also tested in previous, non-beta versions of Unity), compiling in XCode 4.2. When compiling, I receive the following errors in EAGLViewAdditions.h:


    Code (csharp):
    1. Line 12 - Unexpected '@' in program
    2. Line 16 - Use of undeclared identifier 'imageFromEAGLView'
    3. Line 18 - Use of undeclared identifier 'snapshotEAGLView'
    4. Line 20 - Unexpected '@' in program

    In addition, I receive a number of errors in AppController.mm, including:

    Code (csharp):
    1. Line 592 - Extraneous ')' before ';'
    2. Line 594 - Use of undeclared identifier 'CreateSurfaceMultisampleBuffers'; did you mean 'CreateSurfaceMultisampleBuffersGLES'?
    3. Line 602 - Use of undeclared identifier 'previousSamples'
    4. Line 605 - Use of undeclared identifier 'previousSamples'
    5. Line 606 - Use of undeclared identifier 'CreateSurfaceMultisampleBuffers'; did you mean 'CreateSurfaceMultisampleBuffersGLES'?
    6. Line 610 - No viable conversion from 'UIImage *' to 'CGAffineTransform'
    7. Line 615 - Expected external declaration
    8. Line 617 - Expected unqualified-id
    9. Line 618 - Expected external declaration

    In some ways, it feels almost like XCode does not think these are Objective-C files, as it seems to be choking on Objective-C related syntax. I have verified that the PostProcessorBuildPlayer and PostProcessorBuildPlayer_Etcetera files are both executable, and I have attempted adding and removing the Etcetera addon numerous times. To be honest, I have been trying to get this to work for about 5 months and have tried numerous versions of the Etcetera plugin over time, each with this exact same problem. Unfortunately now I am at a point where I need to get this fixed, so it's time to start asking in the forums.

    Thanks in advance for any help someone could give!
     
  17. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Dcalabrese, try the following:

    - delete the contents of the Assets/Etcetera folder
    - reimport the latest version of the plugin
    - delete the AppControllerPushExtensions files (2 of them)
    - do a Build and Replace

    That *should* get you running with the Unity beta. You have some really old files still lingering that are causing the errors. Removing the push files is necessary until we get the Unity 3.5 final and release a proper compatibility fix.
     
  18. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    Removing the old files fixed the problem. Thanks!
     
  19. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    One additional question. I am attempting to take a screenshot and then save it to the Camera Roll on the device. Here is the code that I am using, and have been testing this on an iPad 2:

    Code (csharp):
    1. string DocumentsPath = Application.dataPath.Substring (0, Application.dataPath.Length - 5);
    2. DocumentsPath = DocumentsPath.Substring(0,DocumentsPath.LastIndexOf("/"));         
    3.        
    4. StartCoroutine(EtceteraBinding.takeScreenShot("image1.png"));
    5. EtceteraBinding.saveImageToPhotoAlbum(DocumentsPath + "image1.png");
    This code produces no errors, and I do see this in the XCode console when it is run:
    about to send file over playerconnection /var/mobile/Applications/BF9866FD-38D3-47A8-8B88-0BD0FAE52826/Documents/image1.png with length 443857

    However when I check my Camera Roll, the image is not there. Is there something I am missing in my code?
     
  20. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @DCalbrese, it doesn't look like you are yielding on that StartCoroutine so the image wont yet exist when you go to save it.
     
  21. ryangreen8

    ryangreen8

    Joined:
    Jan 26, 2012
    Posts:
    12
    Hi @prime31,

    I'm trying to end a match using your turn based multiplayer plugin, I've updated the outcome of the participants, however the method signature for the end match method is:

    endMatchInTurnWithMatchData(byte[] data)

    But I'm not sure how to encode my GKTurnBasedMatch. Do I turn it back to a json string and encode that?
     
  22. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Ryan, the byte[] passed through should be whatever the match data for your current match is. If it is an encoded JSON string than that would be the proper thing to send.
     
  23. ryangreen8

    ryangreen8

    Joined:
    Jan 26, 2012
    Posts:
    12
    Hits forehead, thanks. I found setMatchOutcomeForParticipant to set the outcome...
     
  24. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    Ok... I have reworked my code to be inside of a Coroutine. This looks better, however the result is the same - nothing saves to the Camera Roll.

    Here is the updated code:

    Code (csharp):
    1. IEnumerator saveImage()
    2. {
    3.     string DocumentsPath = Application.dataPath.Substring (0, Application.dataPath.Length - 5);
    4.         DocumentsPath = DocumentsPath.Substring(0,DocumentsPath.LastIndexOf("/"));         
    5.        
    6.         yield return StartCoroutine(EtceteraBinding.takeScreenShot("image1.png"));
    7.         EtceteraBinding.saveImageToPhotoAlbum(DocumentsPath + "image1.png");
    8. }
     
  25. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @D, did you then call your method in a Coroutine like this: StartCoroutine( saveImage() )
     
  26. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    Aye, I have. I call it like this:

    StartCoroutine(saveImage());

    I added the following line in the bottom of saveImage() to make sure it is running:

    EtceteraBinding.showAlertWithTitleMessageAndButton("","Photo Saved!","Okay");

    The alert dialog does display, however the image is not being saved.
     
  27. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @D, the only thing I can think of then is the way you are getting the path. Have you DebugLogged the path or done a System.IO.File.Exists on it to ensure it is correct? Is there any reason you aren't using persistentDataPath?
     
  28. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    Allright - I got it! The problem was that I was using that weird Documents retrieval method instead of persistentDataPath. I changed it to that and all worked well. Thanks again!
     
  29. ryangreen8

    ryangreen8

    Joined:
    Jan 26, 2012
    Posts:
    12
    Hi Prime, I gotta bug report. the turnBasedMatchmakerViewControllerPlayerQuit method in your turn based plugin isn't passing the match...

    Code (csharp):
    1.  
    2. // Player quit
    3. - (void)turnBasedMatchmakerViewController:(GKTurnBasedMatchmakerViewController*)viewController playerQuitForMatch:(GKTurnBasedMatch*)theMatch
    4. {
    5.     [viewController dismissModalViewControllerAnimated:YES];
    6.  
    7.     UnityPause( false );
    8.     UnitySendMessage( "GameCenterTurnBasedManager", "turnBasedMatchmakerViewControllerPlayerQuit", "" );
    9. }
    10.  
     
  30. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Ryan, if I recall, that method can only be called when a match is already selected and running so you should already know which match it is. If you know a way for it to occur outside of the current match please let me know and I'll amend it.
     
  31. ryangreen8

    ryangreen8

    Joined:
    Jan 26, 2012
    Posts:
    12
    When the user is in the viewController popup and swipes a match item from right to left, a Quit button is revealed. Tapping that fires the playerQuitForMatch delegate.

    So it is foreseeable that a user would quit a match without that match being selected...

    Which brings up another issue. Right now, my fix is to pass the match to turnBasedMatchmakerViewControllerPlayerQuit unity delegate, however, to quit a match requires match data.

    f the match I am quitting isn't my current match, I don't have the matchdata. To fetch it, I need to call loadMatchData, but that method doesn't accept a match parameter because the plugin interface only supports one match at a time. This means when a user quits a non active match, I have to switch the match, load it, then switch back to my current match.
     
  32. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Ryan, good point. We will add the match ID to the callback. The entire turn based API only allows one active match at a time. I have an idea to get that match data returned though that I will play with and see if it is doable.
     
  33. DreamEnder

    DreamEnder

    Joined:
    Apr 12, 2011
    Posts:
    191
    Hey Prime31, when I use EtceteraManager.imagePickerChoseImage and scroll up the list of pictures I have, I can't pick older pictures at the top of the list, only new ones at the bottom. Have you heard of anyone having this problem?
     
  34. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @DreamEnder, I believe I responded to you via email already. I have never heard of their being unselectable images before.
     
  35. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    Setting project to Landscape Left using MediaPlayer plugin, the Media Picker appears in Portrait.

    Obviously any app that ships with this behavior looks very poor.

    Is Media Picker orientation configurable?
     
  36. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Joe, Apple doesn't allow rotation of the media picker. It's definitely worth filing a feature request with them so that they know people want it.
     
  37. cj_coimbra

    cj_coimbra

    Joined:
    Nov 23, 2011
    Posts:
    3
    Hi there,

    Where can I get some example on how to use the alert view buttons? I could make it pop up but I´m unable to get the button events...

    Thanks.
     
  38. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @cj, the *EventListener class has examples of how to listen to every event the plugin has.
     
  39. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    @Mike
    Ok, done thanks.

    Also, can we get track info from a playlist, as in native MP?

    Plugin docs don't seem to mention this, only "current track".

    Seems there is no interface to playlist "items"? Why is this?
     
    Last edited: Jan 30, 2012
  40. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Joe, playlist info is exposed and current track only.
     
  41. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    @Mike

    Not asking about playlist info, asking about "track info from a playlist" in other words, items in a playlist.

    Is this not supported? And why not?
     
  42. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Joe, it isn't supported due to the mechanism used to retrieve and play the tracks. The collection of tracks selected isn't kept in memory. It is immediately handed off to the player. To have individual track support would require a vastly different and more complicated API.
     
  43. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    @Mike, why not hook into the existing MP Playlist class to make the songs query?

    http://developer.apple.com/library/...Reference.html#//apple_ref/doc/uid/TP40008217

    Code (csharp):
    1. MPMediaQuery *myPlaylistsQuery = [MPMediaQuery playlistsQuery];
    2. NSArray *playlists = [myPlaylistsQuery collections];
    3.  
    4. for (MPMediaPlaylist *playlist in playlists) {
    5.     NSLog (@"%@", [playlist valueForProperty: MPMediaPlaylistPropertyName]);
    6.  
    7.     NSArray *songs = [playlist items];
    8.     for (MPMediaItem *song in songs) {
    9.         NSString *songTitle =
    10.             [song valueForProperty: MPMediaItemPropertyTitle];
    11.         NSLog (@"\t\t%@", songTitle);
    12.     }
    13. }
    Is that really "vastly different" and require a "more complicated API"? Seems pretty straightforward.
     
    Last edited: Jan 30, 2012
  44. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Joe, it can certainly be done but a playlist or chosen list of songs is of indeterminate size. It is not uncommon to have lists of 10,000+ songs which is not something that you want to be serializing, sending across the managed-to-native boundary then deserializing. Showing that list is way more efficient on the native side where Apple manages and lazy loads/unloads the data. What is the use case for needing all the data?
     
  45. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    @Mike Desire to find if user has recommended songs available.

    Maybe include a means of searching for tracks based on criteria?
     
  46. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Joe, ahhh. That is a very specific problem that most likely wouldn't be of much use to the majority of users. We try to shoot for feature sets with mass market appeal and always add features based on the number of requests received. Adding a search interface would then necessitate adding a way to play only those songs found in the search result. You can see how that quickly degrades from a common use case.
     
  47. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    @Mike
    In all fairness, it's not really for you to say how users should access MediaPlayer functionality. Esp. if you're calling yours a MediaPlayer plugin.

    With that name, I'd expect it to offer the functionality provided by MediaPlayer, not your desire-to-minimize-your-workload understanding of what someone may or may not want.

    Logically # of requests isn't an accurate metric, as it does not include the # of people who see your plugin doesn't do what MediaPlayer does and moves on to another solution.

    From the looks of it, currently the "MediaPlayer" plugin doesn't support a large number of MediaPlayer framework functionality; video, track info other than current, and a slew of other features supported in the native iOS MediaPlayer.


    To say, think it is misleading to call your plugin MediaPlayer when it really is more just a Audio Playback controller.

    Would you consider updating the name to better allow for another developer whose goal is to actually offer MediaPlayer support? (i.e. not just audio playback)
     
  48. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Joe, in all fairness, the plugin does not ever pretend to expose the entire MediaPlayer.framework. The subtitle right from the description is "iPod audio support". The plugin was made specifically to appease the many user requests we received whereby users wanted to be able to use the iPod player and playlist view. It wouldn't make any sense for us to change the name of a plugin that has been available for over a year and half.

    As I stated before, we create plugins based on the needs of users as expressed to us via feature requests. We aren't trying to "say how users should access MediaPlayer functionality" as you put it. We are providing the most requested features in a package that is as easy to use as possible. On a related note, it is not our "desire-to-minimize-your-workload understanding of what someone may or may not want". The features exposed are directly based on requests we received. They *are exactly* what people want and have asked for.
     
  49. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
    @Mike can we agree that calling it MediaPlayer seems misleading given only base audio playback functionality is offered?

    Otherwise, seems similar to writing a book called "Horses" with only 2 chapters and they are both only about saddles.

    In any case, consider this a feature request for the following (in priority):

    - method to search library for single song and play back if found.
    - delegate for when a track finishes (unless songChanged is called even when active queue contains 1 song? confusing.)
    - method to search library for name in song titles artist and get results as an array for selective playback (would need a new Play method?).

    For the first third, the MPMediaQuery class is dedicated entirely to searching:
    http://developer.apple.com/library/...Reference.html#//apple_ref/doc/uid/TP40008220

    Surely means to use songsQuery (at min.) could be supported without much complication?
     
    Last edited: Jan 30, 2012
  50. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Joe, we've got an update coming and we'll add querying to it. We've got an internal build with a different structure that we may make public as well. It is quite a bit more complicated with the value-add being that audio is played back via the Unity engine so it is way easier to control.
     
Thread Status:
Not open for further replies.