Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 fraguada · Jul 10, 2019 at 08:32 AM · assemblyc# dllscripting-underthehood

Reference DLL from installed application

I'm trying to reference some DLLs which expose APIs to an installed application (Rhino 3d). These DLLs target .Net framework 4.5, and work on both Windows and macOS when developing plugins for said application. We have an example which loads one of the DLLs (by copying it to the project Assets folder) and uses the API. The example is here: https://github.com/mcneel/rhino.inside/tree/master/Unity. While this works, copying the DLL to the Asset folder is not a solution we see viable going forward. The audience that will use this will have both Unity and Rhino installed, so we need that the Rhino DLLs stay in place.

While trying to extend the example, I'm having issues referencing another DLL. If I copy this DLL to the project Assets folder, Unity tries to load it, but it cannot resolve its dependencies. In the Unity console I see that the DLL cannot be loaded and it lists the dependencies with an error that it cannot find the dependency OR the dependency is not compatible. I've tried other ways to load this dependency, for example with Assembly.LoadFrom() which seems to work ok, but then I will have to reflect any part of the API that I need to use.

My application assumes the user is running Unity on Windows and has Rhino installed. For now I've been testing on Unity 2018.3.

Before going further, I'd like to ask:

  1. Can one reference DLLs for a Unity project WITHOUT copying them to the Assets folder? I've seen the documentation refer to csc.rsp for including other DLLs, but I am not sure if this will work with DLLs not in GAC. I've tried an assembly resolver, creating an event handler to catch resolving issues, but it seems by the time I add this code, Unity already complains that it cannot find the dependencies needed by the DLL.

  2. If there is no other way than to copy it to the Assets folder, what is a reasonable approach to resolve any potential dependencies a DLL might have?

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

1 Reply

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

Answer by fraguada · Jul 10, 2019 at 10:34 AM

In my particular case, I was trying to use the Rhino.Inside technology to have the RhinoCommon and Grasshopper APIs running next to the Unity APIs. The sample developed to run Rhino.Inside.Unity, which exposes a simple function to create a NURBS surface from a series of points (defined as spheres in Unity) works probably due to the fact that the code needed to create that surface is native, and thus, the Mono Runtime should be able to access it (since the DLL path is added as an Environment Variable). The Grasshopper API depends on other DLLs. While all of these DLLs could theoretically be copied, you would be coding one API from Mono, and seeing Grasshopper hosted on .Net, and the two would never know about each other. For further information on this particular case, see the post on this issue: https://github.com/mcneel/rhino.inside/issues/121#issuecomment-509997598

In conclusion, the potential solutions to this issue do away with any of the benefits that one might gain from using the Rhino.Inside technology (having Rhino and Host APIs side by side). Other solutions exists that run Rhino / Grasshopper independently from Unity, and communicate between them via sockets, for example, the Speckle client for Unity, Rhino.Compute + RESTHopper.

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

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

namespace support in unity 1 Answer

C# dll "MissingMethodException" - Before first recompile 1 Answer

Unable to load assembly without recreating project 0 Answers

How to resolve script references in scene bundles from dynamically loaded assemblies? 1 Answer

Serializing System.object or System.Type doesnt work. Data is lost. 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