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
2
Question by HazeTI · Jul 03, 2012 at 04:26 PM · pluginmacosxdylib

How to include dependent dylib for Mac plugin?

The problem is not in the building of my plugin but in allowing Unity to see a 3rd party .dylib.

On Windows I solved this by making sure my code loaded both dll's (using DllImport) and then everything worked fine. I've tried that approach on Mac but that appears not to have worked.

I've read this post and this post to no avail. Possibly because I'm not entirely sure of what I'm doing on a Mac. I'm sure this must have been solved many times over so I'm surprised there isn't clearer docs about this.

Can you help?

Thanks.

Comment
Add comment · Show 1
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 HazeTI · Jul 04, 2012 at 09:39 AM 0
Share

I found another post (http://answers.unity3d.com/questions/208625/unity-cannot-find-dependent-dylib-for-plugin.html) that suggested getting the author to change the "Installation Directory" on the 3rd party library, but that's not really an option I can follow.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by HazeTI · Jul 06, 2012 at 08:38 AM

I finally managed to achieve this. This link was extremely useful (as was this). The steps I took were:

  1. Find what the install directory for the 3rd party library is. I used otool for this. Luckily for me the library did use @loader_path.

  2. In your xCode Plugin project, in build phases add the 3rd party .dylib to link binary with libraries.

  3. Add a new "Copy Files" build phase (button bottom right "Add Build Phase").

  4. Depending on what the 3rd party installation directory is set the Destination appropriately. In my case, since it was straight @loader__path I set it to Executable. The other common ones are @executable_path/../Frameworks or @loader_path/../Frameworks, in which case set it to Frameworks.

  5. Add the 3rd party .dylib to the list.

  6. Build!

The .dylib is now included in your bundle and your plugin can call functions from this 3rd party library with no issues. Note that you won't be able to call the 3rd party library functions from Unity, or at least I couldn't figure out how to.

I hope that helps someone, took me days to figure this all out!

Comment
Add comment · 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

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

6 People are following this question.

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

Related Questions

What to choose to make .bundle plugin in XCode? 1 Answer

Unity fails to include .bundle for native code plugin when building Intel Mac player. 0 Answers

Why doesn't my bundle build for Mac OS X using Xcode 4.5? 1 Answer

Does Unity 5 support OSX i386 plugins (without x86_64)? 0 Answers

linked dylib in ios project: Unity 5 0 Answers


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