• 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 michwisz · May 08, 2018 at 10:51 AM · plugindll error

Native DLL not working on build

Hello everybody, I've got an issue. I'm currently working on a Unity project which requires using some native DLLs. While everything works fine in editor, the built is somehow not able to load libraries correctly. I've tried adding DLLs into Plugin folder in project tree as well linking against DLLs in "outside of a project" location - the results are the same. Moreover, I've tried to do this on both basic and PRO editions with the same results.

What's interesting C# made DLL's are working fine both in editor and build, but C# wrapped native DLLs are not. In attachement is log file from launching project *.exe.

DLLs and project are built in 64 bit architecture. Hope you guys would be able to help me somehow.

output-log.zip (1.5 kB)
Comment
Add comment · Show 4
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 Bunny83 · May 09, 2018 at 05:54 AM 0
Share

Well, your DLL failed to initialize. This could have various reasons. Does your project use ".NET 2.0" or .NET Subset or IL2CPP? A C# managed assembly is something completely different from a native DLL. They share the same name and header, but that's all. In what language is your native DLL written? Does it have any external dependencies?

avatar image michwisz Bunny83 · May 09, 2018 at 07:32 AM 0
Share

First of all, thanks for your reply! In project setting, in "Configuration" section I've set "Scripting Runtime Version" as .NET 3.5 Equivalent, "API Compatibility Level" .NET 2.0 Subset.

DLL is written in C++, it does not use any other DLLs (is that what you had in $$anonymous$$d with "external dependencies"?)

avatar image Bunny83 michwisz · May 09, 2018 at 08:35 AM 0
Share

Try setting the API Compatibility Level to ".NET 2.0" (not subset). If it's written in C++, do you use extern "C" when exporting methods? Do you have any code in the DLL main / initialization callback?

Show more comments

1 Reply

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

Answer by michwisz · May 11, 2018 at 12:35 PM

Problem is solved - the strange issue was caused by compiler used to build .dll library. After rebuilding DLLs in Visual Studio Community 2017 is working like a charm.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

83 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 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 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 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

Dll not found exception: unable to load dll 0 Answers

Cant link PLUGIN.DLL with PLUGIN-EDITOR.DLL 1 Answer

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

How to fix failed to load assets/Plugins/filename.dll with error the specified module could not be found and DllNotFoundException: Assets/Plugins/filename.dll 1 Answer

.NET dll seen as native in Unity3D 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