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
0
Question by vagran · Apr 14, 2014 at 10:25 AM · native pluginos x

Cannot make native plugin working on OS X.

Hi, I am trying to make working native plugin on OS X.

If I build it using Xcode as bundle and put it to the Assets/Plugins directory it cannot be loaded by the application throwing System.DllNotFoundException. I tried with and without "lib" prefix with no luck. I see the following messages in the log preceding the exception:

 Fallback handler could not load library /Applications/UgCS/ugcs-client/ugcs-client.app/Contents/Frameworks/MonoEmbedRuntime/osx/./libucs_video.dylib
 Fallback handler could not load library /Applications/UgCS/ugcs-client/ugcs-client.app/Contents/Frameworks/MonoEmbedRuntime/osx/./libucs_video.so
 Fallback handler could not load library /Applications/UgCS/ugcs-client/ugcs-client.app/Contents/Frameworks/MonoEmbedRuntime/osx/./libucs_video.bundle
 Fallback handler could not load library /Applications/UgCS/ugcs-client/ugcs-client.app/Contents/Frameworks/MonoEmbedRuntime/osx/libucs_video

So I tried to build just the dynamic library and put it as ugcs-client.app/Contents/Frameworks/MonoEmbedRuntime/osx/./libucs_video.dylib. And it partially works - the exception is not longer thrown and I'm able to call functions from the plugin in the application scripts. However there is still a problem - UnityRenderEvent() callback is not called by the Unity so the plugin is unable to do any rendering. Also I am confused by this way because it obviously is not the one described in Unity documentation.

I have verified that the plugin itself and all its dependencies have the correct architecture (the one for which the application is compiled), and otherwise the partially working workaround would not work.

Does anyone could help with this problem?

Comment
Add comment · Show 5
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 GrahamReeves ♦♦ · Apr 14, 2014 at 10:39 AM 0
Share

Are you still calling GL.IssuePluginEvent from your c# code?, could you post your c# and maybe there's a problem there?

I have a plugin with the line extern "C" void EXPORT_API UnityRenderEvent(int eventID); (C++) and that's all I need in my plugin code (for osx and windows) for it to get called

avatar image vagran · Apr 14, 2014 at 11:32 AM 0
Share

Yes, I definitely call it in the following manner:

 IEnumerator
 Start()
 {
     yield return StartCoroutine("OnFramesEnd");
 }

 private IEnumerator
 OnFramesEnd()
 {
     while (true) {
         /* Wait until all frame rendering is done. */
         yield return new WaitForEndOfFrame();
         GL.IssuePluginEvent(<some_id_here>);
     }
 }
avatar image vagran · Apr 14, 2014 at 01:26 PM 0
Share

Also forgot to mention that UnitySetGraphicsDevice() is also not called.

avatar image GrahamReeves ♦♦ · Apr 14, 2014 at 01:39 PM 0
Share

It's possible that the "unused" functions/symbols are being stripped at compile time. You could check those symbols (UnitySetGraphicsDevice and UnityRenderEvent) are still in the .dylib after compiling with ter$$anonymous$$al

https://developer.apple.com/library/mac/documentation/Darwin/Reference/$$anonymous$$anPages/man1/nm.1.html https://developer.apple.com/library/mac/documentation/Darwin/Reference/$$anonymous$$anpages/man1/symbols.1.html

If that's the case, there is a build option to strip symbols you can turn off (Not sure exactly where this is offhand, but should be easy to find with the filter :)

avatar image vagran · Apr 15, 2014 at 07:22 AM 0
Share

Both functions are exported:

 $ nm libucs_video.dylib | grep UnitySetGraphicsDevice
 00024710 T _UnitySetGraphicsDevice
 $ nm libucs_video.dylib | grep UnityRenderEvent
 0000af20 T _UnityRenderEvent


Also I did not heard that such behavior is possible because all source files are compiled separately and the compiler does not know which functions will be used from other sources (as well as from library users).

0 Replies

· Add your reply
  • Sort: 

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

22 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

How to create a native OS X plugin from a static C++ .a library 0 Answers

OS X Native plugin callback functions 1 Answer

UnitySetGraphics not called in native plugin 1 Answer

CFStringGetCharacters in Unity5.0 crash? 2 Answers

IssuePluginEvent - Passing Additional Parameters 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