Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

iPhone OS4 today

Discussion in 'iOS and tvOS' started by maxfax2009, Apr 8, 2010.

  1. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,306
    Um ... could we all return to using standard fonts and colors? This thread now looks like a kid's painting (well, kind of a fun change after almost 250 pages ;-) ).
     
  2. donlien

    donlien

    Joined:
    Apr 13, 2009
    Posts:
    229
    Sorry about that. :oops:

    Since it is too emergent critical for me by project deadline.
     
  3. VIC20

    VIC20

    Joined:
    Jan 19, 2008
    Posts:
    2,681
  4. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
  5. donlien

    donlien

    Joined:
    Apr 13, 2009
    Posts:
    229
    But if the app save game process in OnApplicationQuit(), it will fail when app is killed in Multi-Tasking bar.
     
  6. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    You have 2 options:

    1. as previously noted, just add UIApplicationExitsOnSuspend to get the old style of quite on touch home button
    2. add the applicationDidEnterBackground: method to the generated Xcode project to the AppDelegate and save state then.

    Method 1 will not support multitasking and method 2 will work with multitasking/fast app switching.
     
  7. donlien

    donlien

    Joined:
    Apr 13, 2009
    Posts:
    229
    I can only use Method 1, because my Unity is indie version.
     
  8. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    Thats not true. Indie can go either way.
     
  9. donlien

    donlien

    Joined:
    Apr 13, 2009
    Posts:
    229
    Sorry... I can not understand how to do the Method 2. :oops:
     
  10. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Instead of offenses and insults, it's much more calm this way =) Lol
     
  11. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    I don't have the Xcode project folder with me right now so I don't know the exact code needed. What you do need to do though is add the applicationDidEnterBackground: method to the generated Xcode project to the AppDelegate. In that method you can probably just call applicationWillTerminate:. I believe that is how Unity triggers the callback to C# but without Unity in front of me it's hard to say for sure. The only other way it could be done is if Unity uses the UIApplicationWillTerminateNotification but I don't think they do. Someone with Unity in front of them can confirm im sure.
     
  12. jerrodputman

    jerrodputman

    Joined:
    Jun 4, 2008
    Posts:
    181
    @uprise78: Yeah, you don't want to call applicationWillTerminate: as that shuts down Unity, which would defeat the purpose of fast app switching (plus you'd have to restart it again manually).

    edit: If you're an Advanced licensee, you can do this little trick I just tried:

    Code (csharp):
    1. - (void)applicationDidEnterBackground:(UIApplication *)application
    2. {
    3.     printf_console("-> applicationDidEnterBackground()\n");
    4.     UnitySendMessage("Some Game Object", "SomeSaveFunction", "Some message.");
    5.     UnityPause(false);
    6.     UnityPlayerLoop();
    7.     UnityPause(true);
    8.  
    9.     [[NSUserDefaults standardUserDefaults] synchronize];
    10. }
    11.  
    You'll need to move all of your save code into the "SomeSaveFunction" of the "Some Game Object" (and naturally, that object should exist if you want it to do anything). Not the most elegant solution, but it works for now.

    edit 2: Added NSUserDefaults synchronizing since that doesn't automatically happen when applicationDidEnterBackground: is called.
     
  13. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    @jerrodputman

    do you know if this is possible in Unity iPhone basic specifically in Unity3? I know you stated it wont work in Unity iphone basic 1.7. Seems to be a very necessary type of technique for iOS4

    EDIT: thanks for the info Jerrodputman :)
     
  14. jerrodputman

    jerrodputman

    Joined:
    Jun 4, 2008
    Posts:
    181
    I don't know if it works in the current beta (haven't tried it), but I know they're allowing native plugins for all license types in Unity 3. But they've also said they're adding iOS 4 specific stuff as well, so this little trick probably won't be necessary for long.
     
  15. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    I think you misread. donlien didn't want to take part in fast app switching. Your code will fast app switch which isn't the desired behavior for donlien.
     
  16. jerrodputman

    jerrodputman

    Joined:
    Jun 4, 2008
    Posts:
    181
    Ah, I see. Actually, that still probably wouldn't work (it would just shut down Unity, but wouldn't kill the app). Personally, I'm not sure why anyone wouldn't want to support fast app switching.
     
  17. veracious

    veracious

    Joined:
    Jan 15, 2010
    Posts:
    22
    Did you guys notice HiggyB's comment on Vimeo?

    Isn't it a bit weird to put that sort of detail in there instead of unity3d.com?
     
  18. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    I was hoping to have microphone(and camera) access in iPhone basic, this is great news.
     
  19. n0mad

    n0mad

    Joined:
    Jan 27, 2009
    Posts:
    3,732
    I guess it's because Mr. Helgason already stated it on the Unity blog monthes ago ?
     
  20. SquiggleDome_2

    SquiggleDome_2

    Joined:
    Nov 11, 2009
    Posts:
    84
    "... we are exposing native Objective-C usage to both Unity iPhone licenses in 3.0 ..."

    Sounds good to me. :D
     
  21. Lokken

    Lokken

    Joined:
    Apr 23, 2009
    Posts:
    436
    I mean can you imagine the uproar if they made that a pro-only feature?

    And honestly I bet that it is a requirement from Apple that any package of theirs that deploys to the iPhone allows native access. So I would wager they couldn't make it a pro-only feature even if they were so inclined.
     
  22. Randy-Edmonds

    Randy-Edmonds

    Joined:
    Oct 10, 2005
    Posts:
    1,122
    Anyone have an example of how Unity 3 will implement native Objective-C usage? I mean... will Unity allow for Objective-C "scripts" that will actual have as part of the project or will it simple have an enhanced "plugin" functionality? I hope that it treats objective-c as a first class language in the editor.
     
  23. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    No go on that. Obj-C calls are still dirt slow through the plugin system.
     
  24. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
     
  25. Randy-Edmonds

    Randy-Edmonds

    Joined:
    Oct 10, 2005
    Posts:
    1,122
    Seriously? How do you know?
     
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    I have the beta.
     
  27. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Its just plugins for all, nothing more.
    As such all the stuff you know about plugins applies.
     
  28. Per

    Per

    Joined:
    Jun 25, 2009
    Posts:
    460
    Has anyone profiled this to find out where the bottleneck is with regards objective c plugins?

    I mean it shouldn't really be all that complex, accessing a library usually is very few assembler calls (just function pointer, move, branch).
     
  29. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    Unfortunately, it's a bit more complicated than that from my limited understanding. Check out the mono docs: http://www.mono-project.com/Interop_with_Native_Libraries

    Jumping from managed to non-managed will always have a performance hit and then you have to deal with not being able to pass back and forth anything more than UTF8 strings, raw data and value types. Throw the fact that it won't work in the editor and you can't debug it into the equation and they are all but useless except in the most dire times of need.
     
  30. sourcerer

    sourcerer

    Joined:
    Oct 8, 2008
    Posts:
    119
    Well, that means the calling overhead is slow, wouldn't this mean that if you code a significant portion in Obj-C and call into it through only one call the performance hit is manageable and you have the best of both worlds - a C++ game with a a good editor.
    Of course, this is assuming that you can still get through to the data once you are in C++.

    Kaj
     
  31. Radical

    Radical

    Joined:
    Jan 15, 2009
    Posts:
    32
    You can debug it in Xcode. It's not a very good debugger, but it works.
     
  32. Radical

    Radical

    Joined:
    Jan 15, 2009
    Posts:
    32
    My take on it is that you should only use the plugins to talk to external accessories and functionality that Unity hasn't exposed.

    If you have native code that does something significant than go for it, but Unity docs say that the overhead is so great, that you should try limiting plugin calls to only one per frame. In a game I worked on, I had to make a few per frame, and I didn't see the framerate drop, but it shows how expensive Unity believes the calls are.

    I don't think it's viable to code a game inside of a plugin.

    I could be wrong. It's happened before. :)
     
  33. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    I actually like Xcode/GDB just fine. Please do share how you can debug a plugin. It would make plugins orders of magnitude more useful for me if I could debug them.
     
  34. LeoNgai

    LeoNgai

    Joined:
    Jan 27, 2010
    Posts:
    26
    Hi, now the new iOS 4 has been rolled out and all of us were asked to accept the new TOS 3.3.1/2 agreement before uploading new apps for approval. Has anyone of you got approved by using Unity after accepting the new TOS? Thanks!!!
     
  35. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,252
    I haven't checked this thread in a while, but it seems to have wandered off topic in the last 50 pages or so. Is there any news about whether or not we can still use Unity under the new Apple TOS? Or has it just become a non-issue?

    I'm starting to get the impression, after several months with no news, that we will never get a definitive answer one way or the other. No way we would go this long without an answer, unless no answer is forthcoming. I'm interpreting this non-response from the Unity team as them telling us, "Move along, nothing to see here." That we should just keep doing what we've been doing until or if Apple starts rejecting Unity apps. Which is pretty much all I can do, as I can't just put everything on hold for months for an answer that may or may not ever come.
     
  36. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    Well, Apple changed their TOS and it looks like Unity is fine (to me at least), but there's no official "you can use Unity" from Apple. So it's still down to interpretation, but personally I'm not worried anymore.
     
  37. LeoNgai

    LeoNgai

    Joined:
    Jan 27, 2010
    Posts:
    26
    Yes, I understand. I have another Unity game submitted on June 21 after I accepted the new TOS. Today I just received the status change notification from Apple, stating that is "In Review". Let's see how it's going....
     
  38. Radical

    Radical

    Joined:
    Jan 15, 2009
    Posts:
    32
    Just set a breakpoint in the Objective-C code. It'll trigger just fine.
     
  39. Big Pig

    Big Pig

    Joined:
    Feb 21, 2009
    Posts:
    92
  40. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    Java? you should be burned alive for even suggesting it. C# is bad enough.
     
  41. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Someone didn't watch the video before commenting.
     
  42. willtris

    willtris

    Joined:
    Jan 21, 2009
    Posts:
    38
    good news - iPhone sales numbers are still managing to keep up with the page-count here
     
  43. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    I saw it last week. I work in the corporate world (.NET) and the entire video could just have references to Java be replaced with .NET. The hammer developer (thinking .NET is the perfect solution for every problem) part in the beginning was pretty funny though. I work with a bunch of them.
     
  44. LeoNgai

    LeoNgai

    Joined:
    Jan 27, 2010
    Posts:
    26
    Great news! my Unity game "3D Island War" submitted on June 21 just received "Ready to sale" from Apple! Share with you all! Unity is the best!!! :D
     
  45. noocell

    noocell

    Joined:
    Mar 23, 2009
    Posts:
    104
    Has anybody submitted a Unity app made with Unity iPhone Basic (with the "Powered by Unity" logo in the startscreen) under the new TOS ?

    I believe that Unity Team has to rethink about this mandatory logo for the Basic users. We are now digging our graves with such an indiscreetness!
     
  46. LeoNgai

    LeoNgai

    Joined:
    Jan 27, 2010
    Posts:
    26
    Me! I submitted it with unity basic under new TOS
     
  47. noocell

    noocell

    Joined:
    Mar 23, 2009
    Posts:
    104
    Wonderful news! :D

    (I am still believing that it would be safer without the Unity logo)
     
  48. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,043
    @radical - I have set breakpoints in the ide and they don't seem to trigger.

    What's your trick?
     
  49. TBoxman

    TBoxman

    Joined:
    Aug 2, 2008
    Posts:
    29
    Getting rid of the logo is simple. Even I can do it.

    Step 1: Open wallet
    Step 2: Pay UT for their hard work and excellent software.
    Step 3: There is no step 3.

    :)
    Terry
     
  50. domodes

    domodes

    Joined:
    May 18, 2009
    Posts:
    51
    Java and C# are fantastic, OOP too much for you huh?

    Anyway, regarding the video, "Java is the future," it's funny how they're saying that since 1995, re-donkulous.

    Also, Java will not get you a girlfriend.