Search Unity

How to get OSX Unity Player Xcode project?

Discussion in 'macOS' started by eppz, Apr 29, 2017.

  1. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    I'd love to see how the window / view / layer hierarchy builds up, could help a lot with plugin development.

    I have dumped the headers - https://github.com/eppz/Unity.Labs.OSX_Unity_Player_Headers -, so I can see that rendering is carried out on an OpenGL ES view (PlayerWindowViewProxyGLES), but I'm interested more in the actual initialization / hooks.

    Is there any source out there?
     
    Last edited: Apr 29, 2017
  2. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    Nope! I needed this too to write a deeplink plugin but unity precompiles the .app and when building the game, it just injects the resources.
     
  3. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    I already contacted ~8 Unity employee to take a look on this, someone at OSX department told to agreed to reply on this, but nothing since than. They somehow don't share information on this.

    Now I'm about to crack my own app: Using optool to load a dynamic library by injecting loading code directly into the compiled mach-o file. If I could load my swizzling library - https://github.com/eppz/iOS.Library.eppz_swizzler/blob/master/eppz!swizzler/EPPZSwizzler.h - there, I could hijack various methods in AppDelegate - https://github.com/eppz/Unity.Labs.OSX_Unity_Player_Headers/blob/master/PlayerAppDelegate.h - and more.

    While this is ridiculously overcomplicated, this is my best attempt yet. I could modify app window, catch app events and more (hoping that this won't break any general behaviour).
     
  4. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    Next time you are at GDC, you should take a Unity OSX staff hostage. :) The ransom should be an OSX Standalone Player Unity Project.
     
    _Adriaan likes this.
  5. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    Wow, hit some progress here!
    Was able to load my framework before the app loaded!
     
    Last edited: May 6, 2017
  6. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    There!
    Just managed to inject code right into NSAppDelegate.applicationDidFinishLaunching!



    Gonna put up a writeup later on.
     
    Last edited: May 6, 2017
    User340 likes this.
  7. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Do you think this could help with retina? I've attempted hacking the build/app before with minimal luck. Sounds like you've made some real progress. Where are you gonna post your writeup?
     
  8. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    What do you mean by "help with retina"?
    I'll write an article to blog.eppz.eu, probably tweet at @_eppz.
     
  9. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Last edited: May 8, 2017
  10. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    I think 'applicationDidFinishLaunching' is where Unity initializes - you'll want to catch the applicationWillFinishLaunching event if you want to catch the deeplink url!
     
  11. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    User340 likes this.