get your cocoa on integrating objective-c into unity iphone apps brian robbins president/founder –...

13
Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games [email protected] Twitter: @dubane Slides & Source Code: www.dubane.com/cons/ Unity Unite – October 30, 2009

Upload: darleen-goodman

Post on 17-Jan-2018

217 views

Category:

Documents


0 download

DESCRIPTION

Why? Use the best technology for what you need Feel like an iPhone app Access to any iPhone feature

TRANSCRIPT

Page 1: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Get Your Cocoa OnIntegrating Objective-C into Unity iPhone

Apps

Brian RobbinsPresident/Founder – Riptide Games

[email protected]: @dubane

Slides & Source Code: www.dubane.com/cons/

Unity Unite – October 30, 2009

Page 2: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Overview• Background• Creating views• Messaging• Pros & Cons• Q&A

Page 3: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Why?• Use the best technology for what you

need• Feel like an iPhone app• Access to any iPhone feature

Page 4: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Creating Views• Demo

Page 5: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Creating Views• Key code• In ApplicationDidFinishLaunching//Get the application windowUIWindow *topWindow = [[[UIApplication sharedApplication] windows]

objectAtIndex: [[[UIApplication sharedApplication] windows] count]-1];myParentView.center = topWindow.center;[topWindow addSubview:myParentView];

//Next create the MenuViewControllermenuVC = [[MenuViewController alloc] initWithNibName:@"MenuViewController"

bundle:nil];

//Add it to the window so it can be active//Now we can add our Menu to the landscape View and it will appear

[myParentView addSubview:menuVC.view];

Page 6: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Messaging• Demo

Page 7: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Messaging Overview

• Poll NSUserDefaults for message from Unity

• Poll PlayerPrefs.GetString for message from Cocoa

Page 8: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Limitations• Speed?• One message per Unity update• Text only, no binary

Page 9: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Pros• Do anything you want on iPhone• Feel like a native iPhone app• Faster menu design & iteration• Separate workload

Page 10: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Cons• Extra work to test in Unity• Limitations of message system• Fragile vs future Unity updates

Page 11: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

What is enabled• Cocoa menus• In App Purchase• Video playback• Different sound control• OpenFeint, Plus+, etc. integration• AdMob, etc.• PinchMedia, Localytics, etc.• Anything else you want!

Page 12: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Final Thoughts• Pretty straightforward and

lightweight• Make menus & UI native iPhone• Use Enhancement Pack• http://technology.blurst.com/a-cocoa-

based-frontend-for-unity-iphone-applications/

Page 13: Get Your Cocoa On Integrating Objective-C into Unity iPhone Apps Brian Robbins President/Founder – Riptide Games

Q & ABrian Robbins

President/Founder – Riptide [email protected]

Twitter: @dubane

Slides & Source Code: www.dubane.com/cons/