Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by darshie76 · Jul 11, 2010 at 07:52 AM · xcodeembed

how can i add a window running Unity, in an xcode project

I am trying to make a desktop app using cocoa and xcode, and would like to have a window running unity inside the main UIView (something like a managerial game, where you have all your buttons and UI items and then you have the 3d window where something happens ); and i need to load dynamically assets into the unity view,based on what happens in the main view.

I wonder if there is a way to add a component to xcode (like UILabel, UIButton, and so on), so i can use it on a xib file and add an outlet so i can drive unity from my main application.

Thanks

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by ikeo · Sep 28, 2011 at 08:20 PM

I don't agree that Unity isn't "meant for embedding". Unity's iPhone build simply creates an iOS application which has it's own Window, application delegate, etc. They don't make it easy to do so, but you can embed Unity within another application by forwarding all the application delegate methods from your application's delegate to those in the unity app delegate. Basically unhook Unity as the application delegate, create an instance of the Unity view controller manually and forward the delegate methods (ex. ApplicationDidFinishLaunching) to your new unity view controller instance.

Depending on your view setup, you can hack the AppController.mm file to get the Unity View controller and use that in your application. For instance, I've got a tab bar application where one of the tabs is running Unity. It's a bit tricky telling Unity when to start and pausing/unpausing when you switch tabs, but it's totally doable.

In addition, once you have a reference to the Unity view controller, you can use its view just like you would for anything else. You can add sub views (UIKit stuff like buttons for ex.), do layer animations, etc. I've got a UIKit toolbar over Unity which looks pretty spiffy as well.

If there's enough interest in this, I can publish a tutorial. It took me a little while to figure out.

Comment
Add comment · Show 15 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image vxssmatty · Sep 29, 2011 at 12:47 AM 1
Share

I would be very interested in a Tutorial, and I know many other people would be also. $$anonymous$$any of us haven't come with xCode backgrounds, and a pointer in the right direction is always a handy thing.

We're starting to develop some apps that will require integration with iOS SD$$anonymous$$ so this will be a great point to start from. If you ever do write something up, even if its small, know it is definitely appreciated.

Cheers matty.

avatar image jjfster · Oct 22, 2011 at 05:55 PM 1
Share

Yes, please create a tutorial. I know a lot of people that would be very interesting.

avatar image nullpublic · Dec 13, 2011 at 08:14 PM 1
Share

I'll third that, a tutorial on this would be great!

avatar image Zemmmmmy · Feb 28, 2012 at 05:05 PM 1
Share

That would be very helpful for me too!

I need to do the exact same thing, and I had attempted to do what ikeo described a few weeks ago, but I ended up with a LOT of errors in Xcode, mostly about not recognizing classes and objects, even though they were imported/included....

Another point is the project settings. The Xcode project, in which the Unity component needs to be embedded, must have project settings that do not conflict with the iOS code project exported from Unity, especially crucial things, like Automatic Reference Counting.

avatar image Ale Farinella · Jul 07, 2012 at 03:07 PM 1
Share

Thank you very much ! Any tutorial is more than welcome ! Please !

Show more comments
avatar image
1

Answer by Ricardo · Jul 11, 2010 at 08:56 AM

Unity's not really meant for embedding, so I can't think of any trivial answers to this. You could display an HTML page embedded in your application which displays a webplayer, doing Interop via SendMessage. It all seems very convoluted, though.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image darshie76 · Jul 12, 2010 at 07:35 AM 0
Share

Agree; my point is that is totally useless to use the web player if all that i do runs locally; but if it would work then i would be ok; but sadly this approach is not feasible on a project :(

Thanks for the reply anyway; hopefully someone else has another approach?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Debugging "SIGSEGV" error? 2 Answers

Bunch of errors when build unity in xCode 4 Answers

Append prompt gone, only replace 0 Answers

EXEC_BAD_ACCESS question 2 Answers

Unable to deploy to ipod 2nd Gen 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges