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 AsgerHoedt · Jun 12, 2012 at 03:44 PM · plugin64bit32bit

32bit and 64 bit plugin environment

Hey

I'm working on a Unity plugin. Since the editor is 32bit I need the plugin to be 32 bit. However for the final application we are making the assets are so big that we need to build the project and plugin for 64bit. How do developers usually create an environment where 32 and 64bit dll's can coexist in Unity?

What we've found so far is the you can import both dll's and use IntPtr.Size to distinguish between the architectures and invoke the correct dll, but that's not exactly pretty nor efficient. What we would like is something along the lines of

 #if UNITY_STANDALONE_WIN64
     [DllImport ("Plugin64")] ...
 #else
     [DllImport ("Plugin32")] ...
 #endif

so we can choose which to use at compile time. Does Unity or C# support something like this? We've tried _WIN64 and WIN64, but those aren't defined.

Another solution we've found that works but isn't pretty is to simply swap the dll's after the project's been build, but this irks us just as much and isn't exactly a great solution since it requires manual work from the developer each build. (Yes we cold setup a build script and we have, but we would still have to remember to do it for each new project and we all know how forgetful developers are... :))

Hoping someone has a better solution.

/asger

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 Julien-Lynge · Jun 12, 2012 at 04:17 PM 0
Share

You should definitely post the lack of a 32/64 bit directive as a bug/missing feature. Hopefully it would be simple for Unity to add.

avatar image AsgerHoedt · Jun 13, 2012 at 06:04 AM 0
Share

I'm hoping the reason they haven't added a Unity specific one is because C# natively provides it. But yes if C# doesn't either then Unity definitely should

avatar image Julien-Lynge · Jun 14, 2012 at 03:38 AM 0
Share

The only things I've been able to find are runtime. Good luck in your search.

avatar image AndrewRH · Nov 20, 2012 at 09:19 PM 0
Share

I heard this was co$$anonymous$$g in Unity 4 - anyone know what the #define is?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by AndreasSommer · Dec 10, 2014 at 03:18 PM

Unity 5 brings new defines, see here.

Unity 5 will have UNITY_64 and UNITY_32 defines for standalones, as well as UNITY_EDITOR_64 and _32.

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

Need help with a menu and with plugin 0 Answers

Would 64 bit Unity engine elements work in a 32 bit OS machine? 1 Answer

Sending and receiving variable-length arrays to and from DLL 0 Answers

Build a 32bit app on Unity 4.3.4 ? 2 Answers

arm64 architecture issue with unity and iOS 11 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