Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Anyone interested in accessing the entire iOS SDK API from Unity?

Discussion in 'iOS and tvOS' started by u3dxt, Jul 6, 2013.

  1. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
  2. jittiang

    jittiang

    Joined:
    Jul 24, 2012
    Posts:
    11
    @u3dxt - I don't under stand why but look like "liPhone-lib.a" file has no longer in Libraries folder. I think Unity 4 change it to "libiPhone-lib.a". I have rename it and build successful. But I can't buy test product that I have created it in iTune Connect it show error "TransactionFailed: ... Cannot connect to iTune Store "
     
  3. jittiang

    jittiang

    Joined:
    Jul 24, 2012
    Posts:
    11
    @u3dtx - Now I can buy test product. It's my fault, To buy test product should use iTunes Connect Test User.
    Thank you very much for your help.

    Jittiang
     
  4. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    Glad you got it working. Feel free to ask away if you have questions. Thanks for your support!
     
  5. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    A number of you had some issues with setting up In-App Purchases, so I created a end-to-end tutorial:
    [video=youtube_share;HtAK6cqN7VI]http://youtu.be/HtAK6cqN7VI
     
    Last edited: Sep 22, 2013
  6. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    432
    Hi,

    Great plugin ! :p

    @u3dxt : will it be possible to have some basic indications for sending messages from a UIWebView to Unity ? For instance, I would need to pass the content of a DIV to iOS7 speech synthesis.
     
  7. Darkoo

    Darkoo

    Joined:
    Feb 4, 2013
    Posts:
    96
    hello! After reading through this thread I wish I had seen it before I purchased the Prime31 Game center and multiplayer plugins. Since this seems to have lots of possibilities and also for a reasonable price(ofc referring to the real price not the SALE). Anyway I was wondering about if you have had any thought on giving the possibility of integrating the Unity3d's networking features(Network View etc) if that even is possible.

    Btw, great work so far!! I am getting this one.
     
  8. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @Yann sure. check this out ;-)


    @Darkoo I would approach it by using GameKit to do VoiceChat and MatchMaking. With the GameCenter user ids, I would just pass those to the Master Server and create a room. The network traffic will still pass through Unity3D's default NetworkView to keep the networking part cross platform. However, for Asynchronous Turn Based games, you will have to use the GameKit APIs -- in this case, NetworkView no longer makes sense.

    Thank you both for the support! Please help us by writing a review!
     
    Last edited: Sep 24, 2013
  9. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    432
    Hi again,

    Great plugin and plugin author ! :p Thanks a lot for the video and code.
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,574
    I'll write you a review. I haven't used the code yet but your support is great!
     
  11. Darkoo

    Darkoo

    Joined:
    Feb 4, 2013
    Posts:
    96
    @u3dxt: :), I am already doing exactly what you suggested. The benefits of having networkview integrated is that one could use the apples game center server services, thus not having to pay for a server to have your unity network service running and also networkview is very powerfull and makes things so much easier.
     
  12. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    just bought it, anyway i have a request:

    In China people use weibo as tweeter
    and wechat (type wechat in Asset store), could you integrate this too? its as much used as facebook in asia
     
  13. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
  14. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @Darkoo Are you referring to hosting the Master Server? I always thought it was free, but then again, I haven't used it since 1.0beta. I will take a deeper look at NetworkView and see how much I could reuse. At first glance, it doesn't look like I can hijack NetworkView's sockets for sending and receiving data. But it may not be so bad to reimplement network synchronization using GameKit's APIs. I am interested in doing this, but it may take a while. :)
     
  15. Darkoo

    Darkoo

    Joined:
    Feb 4, 2013
    Posts:
    96
    @u3dxt: yes it will probably take some time. It would be a very good feature to have. I don't believe any one takes this approach, Photon ulink and other I think all require you to buy server service. As you said if not possible to "hijack" networkView's data transferring methods an similar solution inserted in you plugin would be havens worth!
     
  16. Tripwire

    Tripwire

    Joined:
    Oct 12, 2010
    Posts:
    442
    Hi u3dxt,

    Is the UIPickerView available? I don't need the High level calls low level calls are fine for me :)
     
  17. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @Tripwire We just added some convenience wrappers around delegates to make them into C# events. Currently I am testing UIPickerView delegates with this model. The old way will still work. But I will send you the new build tomorrow with the UIPickerView and it's Delegates exposed.
     
  18. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,271
    Bought this a few days ago. :) Could I get an example of detecting if a MFI game controller is connected please?

    Thanks
     
  19. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Purchased, but not tried yet.

    Can anyone tell me if there are any issues when using U3DXT in a project that also contains Prime31 plugins?

    Thanks.

    EDIT:

    Just tried importing package for first time and have 2 errors. I think I checked only the iap and social options

    Code (csharp):
    1. Assets/U3DXT/Prefabs/SupportFiles/storekit/StoreProductViewController.cs(4,24): error CS0234: The type or namespace name `StoreKit' does not exist in the namespace `U3DXT.iOS.Native'. Are you missing an assembly reference?
    2.  
    Code (csharp):
    1. Assets/U3DXT/Prefabs/SupportFiles/storekit/StoreProductViewController.cs(82,61): error CS0246: The type or namespace name `SKStoreProductViewControllerDelegate' could not be found. Are you missing a using directive or an assembly reference?
    2.  
    I'm sure this is a decent product but surely the package should be checked before submitting to the Asset Store?
     
    Last edited: Sep 27, 2013
  20. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @tripwire a new build with UIPickerView has been submitted to the asset store.

    @derkoi we just published the MFI controllers usage documentation: http://u3dxt.com/docs/gamecontroller
    Essentially, if the controllers are not paired, GCController.Controllers().Length will be zero.

    @andymads Our post process script adds the frameworks and libraries to XCode automatically. Are you using our plugin with Prime31 plugins? If so, which ones? There may be conflicts with other plugins who also write things to XCode that we do not know about. Thanks.
    Edit: The error you outlined is in script space. It is our bad trying to coincide with iOS7.0 release timing, just delete that prefab, the upcoming release has that fixed. The APIs themselves are fine.
     
    Last edited: Sep 27, 2013
  21. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,271
    So if I check GCController.Controllers().Length and when it's not zero, check what controller is connected and hide my on screen joysticks and take it from there? Normally I'd use trail and error but with not having an actual game pad to test it with, I need to get it right first time! lol
     
  22. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @derkoi Yeah. It sucks that suppliers couldn't ship game controllers on release day. There were some prototypes available at WWDC for those lucky few. Anyway, the API is not very complex, so I don't think it will be much of an issue. But to answer your question, yes, when GCController.Controllers().Length is zero, then nothing is connected. However, you may still want to provide an interface to ask the user if they want to pair a wireless controller, then listen for the DidConnect event. I mean, since you are doing this so early, your app may be the first app that they've encountered that requires a game controller.

    Code (csharp):
    1.  
    2. gc = new GCController();
    3. gc.DidConnect += delegate(object sender, U3DXT.iOS.Native.Foundation.NSNotificationEventArgs e) {
    4.     // controller is connected
    5.  
    6.    // you should decide whether or not to stop it here because there can be more than 1 controller
    7.    GCController.StopWirelessControllerDiscovery();
    8. };
    9.  
    10. // pair wireless, but probably should be invoked via button or prompt
    11. GCController.StartWirelessControllerDiscovery(null);
    12.  
    13.  
    EDIT:
    Oh, while you are at it, it might be nice to show the touch controls again if the user unplugs the controller or if it runs out of batteries.
    Code (csharp):
    1.  
    2. gc.DidDisconnect += delegate(object sender, U3DXT.iOS.Native.Foundation.NSNotificationEventArgs e) {
    3.     // controller is disconnected
    4. };
    5.  
     
    Last edited: Sep 27, 2013
  23. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,271
    Awesome, thanks!
     
  24. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,271
    Thanks for the edit.

    Will this do the trick?

    Code (csharp):
    1. if (GCController.Controllers().Length == 0) {
    2.             // No Game Controller connected
    3.         }
    4.         else
    5.         {
    6.             // Game controller connected
    7.         }
     
  25. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @derkoi yes
     
  26. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,271
    I can't seem to get Game Center to show leaderboards or the Game Center interface in my app.

    Initializing is working, and posting scores works as if I leave me app and look on the gamecenter app the score is there.

    Here's my code, have i missed anything? Thanks

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using U3DXT.Core;
    4. using U3DXT.iOS.GameKit;
    5. using System;
    6. using U3DXT.iOS.Native.GameKit;
    7. using U3DXT.Utils;
    8. using System.Collections.Generic;
    9.  
    10.  
    11. void Start(){
    12. GameKitXT.ShowGameCenter();
    13. }
    Edit: I've also got another issue with cross promotion. I try to show product view but it shows as a blank screen?
    Seems the scripts are missing from the demo scene. What script should be on the camera object?
     
    Last edited: Sep 30, 2013
  27. tin2tin

    tin2tin

    Joined:
    Aug 22, 2013
    Posts:
    12
    Just purchased. Looking forward to integrate it in our first iOS project.

    Got one question: Is it possible to manually binding iOS SDK functiones ourself if it's not already been exposed by your plugin?
     
  28. DEPT-AU

    DEPT-AU

    Joined:
    Aug 22, 2013
    Posts:
    2
    We are currently having issues when assembly stripping is enabled when displaying the send email dialog. Unity seems to strip out something important and we get null reference exceptions coming from inside the U3DXT libraries. Would you know of a workaround for this? Alternatively do you have a list of dependencies for your classes so we can prevent them from being stripped? Thanks

    Edit: This is the stack trace where the exception is occurring:

    U3DXT.iOS.Native.Internals._ObjectCache._Create (type=, uuid=)
    U3DXT.iOS.Native.UIKit.UIApplication.SharedApplication ()
    MailSender.DoSend ()
     
    Last edited: Oct 1, 2013
  29. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @Two Bulls Thanks for the support! We just submitted version 1.4.0 which has support for stripping for Unity3D Pro users. I've also PM'd you a link to the new build so you don't have to wait for the Asset Store review. To be safe, just delete the U3DXT folder and do a replace when building. Please let me know if the new build fixes the issue, Thanks!

    @tin2tin yes. However, we are planning to do them all. If we don't have a binding that you need at the moment, just send me a PM and we'll expose it first.

    @derkoi you need to authenticate the user first. The authentication code needs to be called whenever the application resumes and launches. try:
    Code (csharp):
    1.  
    2. GameKitXT.LocalPlayerAuthenticated += delegate(object sender, EventArgs e) {
    3.         // just for testing, show the game center every time the player is authenticated
    4.     GameKitXT.ShowGameCenter();
    5. };
    6. GameKitXT.AuthenticateLocalPlayer();
    7.  
     
  30. DEPT-AU

    DEPT-AU

    Joined:
    Aug 22, 2013
    Posts:
    2
    @u3dxt Thanks for that!

    We just worked out a quick fix by adding a link.xml file in the Asset directory root that forces the stripper to keep the U3DXT assemblies. I've uploaded it here: http://pastebin.com/8nKqwFba

    We'll try the version you PM'd and see how it goes.
     
  31. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @Two Bulls Ah, wonderful. :) In version 1.4.0, we wrote the editor script to only include in the link.xml what you are going to use. So, once you are at a good stopping point, please check it out for us. As additional enticement, we've also included the entire MediaPlayer framework in that package. :p
     
  32. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,271
    I do authenticate the player when the game starts, hence why I can post high score. Or am i missing something there?

    What about my other issue with Cross Promotion showing up blank? I have the StoreProductView in my scene and when I click the button to rate my app, all i get is a blank screen.
     
  33. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @derkoi do you mind emailing the relevant portions of your code to support at u3dxt.com and I will take a look at it. As for Store product View, if the ID is invalid, it will be blank. Does the ID from the video/example work?
     
  34. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,271
    I can email the code but they're Playmaker actions, not sure if that would be an issue?

    I assumed my ID was valid since the app is available on the App store? I can try the demo scenes as the scripts are missing from the prefabs when I open the cross Promote demo. There's the 2 script that controls the GUI, the script on the StoreProductView I can easily link up but there's a missing script on the camera? I'm wondering if that's something to do with my issue?
     
  35. braunvonwalter

    braunvonwalter

    Joined:
    Oct 1, 2013
    Posts:
    1
    Hello u3dxt!

    First, congrats for your great work!
    Is it possible to show us some examples written in Javascript?
    I only found examples written in C#.

    Thank you!
     
  36. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,271
    My bad, those issues I had were my fault. Forgot to hook up the NGUI buttons. :rolleyes:
     
  37. Yuuki-Mochiduki

    Yuuki-Mochiduki

    Joined:
    Nov 29, 2012
    Posts:
    11
    U3DXT is great plugin! Thanx!

    ... I'm waiting for AssetLibrary full support.
     
  38. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @braunvonwalter we probably won't maintain two sets of code bases, but if there's a specific example you want in Javascript, I'll write one up for you. However, I do recommend trying C# in future projects because you will have access to a larger featureset than using Javascript.

    @derkoi I am glad you solved the issue. Let me know if you run into trouble anywhere else.

    @Yuuki.Mochiduki Thanks for the support! We just submitted MediaPlayer last week for review; it may contain some APIs that may be useful to you. However, we will work on AssetLibrary next!
     
  39. OceanBlue

    OceanBlue

    Joined:
    May 2, 2013
    Posts:
    251
    Hi again U3 ---

    I've been working all day to try to blend your example of taking a screenshot with the social API sample.

    Essentially, all i want is at end of the game, the player presses the 'social' button and the Activity Sheet pops up so the player can post their screenshot to Facebook/twitter/save to album etc from there.

    I can't seem to figure where or how to integrate this screen capture code though. I had it working in a sense, but it was capturing screenies continuously until it crashed with memory issues. I basically grabbed the SocialTest.cs script and added in "_capture = false;" in Start() and added the PostRender() function into the script. But after this, I"m a bit stuck for getting it to work properly. I won't be using GUI buttons (haven't in my game) - i'll be using a touch on a game object to activate this sharing of the screenie via social networks.

    Thanks for your advice
     
  40. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @OceanBlue Are you setting the _capture variable to false in the PostRender() function?

    Here's another way to do it without using the PostRender() function. I prefer PostRender(), but this way should work just fine and you do not need to attach the script to the Camera.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using U3DXT.iOS.Native.UIKit;
    5. using U3DXT.iOS.Social;
    6. using U3DXT.iOS.Native.Social;
    7.  
    8. public class TakescreenShotButton : MonoBehaviour {
    9.    
    10.     private bool _captured = false;
    11.     void OnGUI()
    12.     {
    13.         if ( GUI.Button(new Rect(0,0,300,50), "Take Screenshot and Share") )
    14.         {
    15.             Application.CaptureScreenshot("screenshot.png");
    16.             _captured = true;
    17.            
    18.             Debug.Log ("TAKE SCREENSHOT: " + Application.persistentDataPath);
    19.         }
    20.     }
    21.    
    22.     void Update()
    23.     {
    24.         if ( _captured  System.IO.File.Exists(Application.persistentDataPath + "/screenshot.png") )
    25.         {
    26.             Debug.Log("screenshot exists: " + Application.persistentDataPath + "/screenshot.png");
    27.             UIImage tmp = new UIImage(Application.persistentDataPath + "/screenshot.png");
    28.             SocialXT.Post(SLRequest.SLServiceTypeFacebook, "combined image test", tmp.ToTexture2D(), "http://www.u3dxt.com", true);
    29.                
    30.             System.IO.File.Delete(Application.persistentDataPath + "/screenshot.png");
    31.             _captured = false;
    32.         }
    33.     }
    34. }
    35.  
     
  41. OceanBlue

    OceanBlue

    Joined:
    May 2, 2013
    Posts:
    251
    Thanks U3dxt! Yeah, I had set it to false in the PostRender()... so wasn't sure what I was doing wrong.

    I'll be trying out your script tomorrow - thanks so much for being so helpful (and saving me a few grey hairs :p)

    Cheers!
     
  42. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Dear Vitapoly,

    congratulation for excellent and chep package with iOS SDK.

    I have just a request.

    I need to have WebWiew inside a PlaneMesh or NGUI object instead of a NewRect(float,float,float,float).

    Can you help me please?
     
  43. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @kaz2057 Thanks! I don't know how to do that, but let's try to discuss it. So, in order to render to PlaneMesh or NGUI, we need a texture right? One way I can think of is to take a screenshot of the WebView and then update the texture in the PlaneMesh or NGUI. However, if the WebView needs to be interactive then you would need to capture those key and mouse events and pass it back to the WebView and do another update. If we are able to give the WebView as a texture to you, would that be enough?
     
  44. WarHead

    WarHead

    Joined:
    Nov 15, 2012
    Posts:
    28
    I know what he's asking and its a large task, but would be really great if possible to put up a 3d webview. I am curious would the webview have audio as well?

     
    Last edited: Oct 5, 2013
  45. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @WarHead Yes, actually you are even able to play YouTube with the webview and the performance is pretty good.
     
  46. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Thanks for interest.
    However I need to interact with web view because it show an entire website.
    It is so difficult have a web view as texture?
     
  47. u3dxt

    u3dxt

    Joined:
    Jul 6, 2013
    Posts:
    317
    @kaz2057 showing it as a texture is not difficult if we are just capturing the webkit view as a texture and applying it to a mesh every once in a while. So that texture becomes a proxy view to the real webkit. However, for full functionality, all webkit interactions need to be marshaled back to the webkit. Simple clicks should be relatively easy to do, but probably want to add in gestures and keyboard input (should the keyboard show up in the texture?) . I am not exactly sure what the performance will be like using this method.
    There is no way that I know of that allows you to just take a view wholesale and just make it 3D. On Linux, there are some hacks that allows you to render your desktop using OpenGL. Then you can do funky things like scale, tilt, and skew your application views. I haven't investigated whether or not this is possible on iOS yet. This task will likely be difficult.
     
  48. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Thanks for infos.

    However about input, the most important fixes are:
    - Single Input touch just to click button to switch on other pagesi
    - Single input touch to scroll page
    - Two finger Input touch to zoom
    Keyboard is not important at this time.

    What you can implement on the 3 input above? Thanks
     
  49. blindgoat

    blindgoat

    Joined:
    Oct 24, 2012
    Posts:
    31
    The plugin looks very promising so far; thanks. I purchased it a few days ago and just started playing with your GameKit stuff.

    Does it work in the simulator? It all works fine so far on device. On your site it looks like all your videos are done in the simulator but I can't get my simple example to run. Right when my app launches I register for GameKitXT.LocalPlayerAuthenticated and then all the TurnBasedMatchesController events and then I call TurnBasedMatchesController.Init().

    This brings up:

    EntryPointNotFoundException: UP_CoreXT_init
    at (wrapper managed-to-native) U3DXT.Core.CoreXT:UP_CoreXT_init ()
    at U3DXT.Core.CoreXT._Init () [0x00000] in <filename unknown>:0
    at U3DXT.Core.CoreXT..cctor () [0x00000] in <filename unknown>:0
    Rethrow as TypeInitializationException: An exception was thrown by the type initializer for U3DXT.Core.CoreXT
    at U3DXT.iOS.GameKit.GameKitXT._Init () [0x00000] in <filename unknown>:0
    at U3DXT.iOS.Native.GameKit.GKLocalPlayer..cctor () [0x00000] in <filename unknown>:0
    Rethrow as TypeInitializationException: An exception was thrown by the type initializer for U3DXT.iOS.Native.GameKit.GKLocalPlayer
    at U3DXT.iOS.GameKit.TurnBasedMatchesController.Init () [0x00000] in <filename unknown>:0
    at GameCenterTest.Init () [0x00000] in <filename unknown>:0
    at GameCenterTest+<Blah>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
    (Filename: Line: -1)

    I know some other plugins I've used (namely Prime31's GC) don't work in the simulator so I expected that from yours as well. I just swear your videos on your site are working in the sim :p

    Also - am I blind or is there no high-level approach for receiving a list of all your matches? I can do it using GKTurnBasedMatch.LoadMatches() but would rather avoid the Native section if you have another alternative.

    Thanks for the plugin and help!
     
    Last edited: Oct 6, 2013
  50. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,827
    Hi all,

    Just getting into this and I was wondering, how could I get this line to work in JavasScript?
    public virtual void SkipToNextItem()
    Everything I try just seems to make it crash...

    Thanks,
    Pete