plugin dependencies

I am on Mac and I made a Cocoa bundle that I want to use as a plugin. If the bundle contains only simple stuff this works. However if I make a bundle, that links to an external Framework I get a Runtime DllNotFoundException, which I expected, because Unity can't finde the dependencies. The question now is what do I have to do to make Unity find the missing dll/shared libraries? If I install the Framework in my ~/Library/Frameworks directory everything works fine, but I would rather not have to install external Frameworks on a users machine. Is there a way to include the needed dll's in the build?

This depends on the way the libraries you are using are built. If they are static libraries, you could just add them to the project, so they will be included in your plugin. If they are bundles or dylibs, they have a search path hard coded into the binary by the linker. This is usually Library/Frameworks, as you said.

If you have source access to the library, you can make a custom build, where you set up the search path relative to the executable, so you can include the dlls in the build. If you don't have source access, your only option would be to manually load the functions from the library (which is more work). I can explain how to do either, but then it would be good to know which case applies to your problem.

I finally figured it out. If you are on OSX10.5 or later you can build the framework with the installation path set to "@rpath". In your plugin bundle you can now specify where to look for the framework using the Linking option Runpath Search Paths. If you include the framework in your bundle (with copy files build phase -> frameworks) you can find it at "@loader_path/../Frameworks".

However there seems to be a problem with aliases during the build process in unity. If you include the framework in your plugin bundle you will get unity build errors when it tries to copy the aliases contained in the framework. ("Headers", "Current" etc.) If you delete those aliases manually from the bundle everything works fine. Maybe that's a Unity bug?