How to get OSX Unity Player Xcode project?

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 - GitHub - Geri-Borbas/Unity.Labs.OSX_Unity_Player_Headers: Dumped class headers from OSX Unity Player executable. -, 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?

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.

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 - iOS.Library.eppz_swizzler/eppz!swizzler/EPPZSwizzler.h at master · Geri-Borbas/iOS.Library.eppz_swizzler · GitHub - there, I could hijack various methods in AppDelegate - Unity.Labs.OSX_Unity_Player_Headers/PlayerAppDelegate.h at master · Geri-Borbas/Unity.Labs.OSX_Unity_Player_Headers · GitHub - 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).

Next time you are at GDC, you should take a Unity OSX staff hostage. :slight_smile: The ransom should be an OSX Standalone Player Unity Project.

1 Like

Wow, hit some progress here!
Was able to load my framework before the app loaded!

There!
Just managed to inject code right into NSAppDelegate.applicationDidFinishLaunching!

Gonna put up a writeup later on.

1 Like

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?

What do you mean by “help with retina”?
I’ll write an article to blog.eppz.eu, probably tweet at @_eppz.

Mac standalone does not support retina displays, it renders in low resolution despite retina displays being out for many years. See here:
https://feedback.unity3d.com/suggestions/retina-for-os-x-standalone-builds

Thanks for the link to your blog, I’ll look forward to your post. Lots of great content there!

I think ‘applicationDidFinishLaunching’ is where Unity initializes - you’ll want to catch the applicationWillFinishLaunching event if you want to catch the deeplink url!

Hey, just finished the writeups (extended scope to iOS as well), the OSX relevant part is at Override app delegate in Unity for iOS and OSX (4/4) Inject code to Mach-O binary.

Once it is setup, there is a whole lot of opportunity regarding OSX player customization.

1 Like