• 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 Moem · Jun 05, 2014 at 10:32 AM · unity plugin

Use Java library in Unity

Hi everybody,

I made a Java library and I would like to be able to use it in Unity 3D, and not only for Android devices, but for iOS as well.

I saw there are some tutorials on the Internet about doing a plugin for Android, but no one on how to use Java library in Unity.

I tried by converting my .jar in a .dll file. I can access my library methods, but it only works when I export my game for Windows devices. So, is there any other way to access my library methods on every device?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Jeff-Kesselman · Jun 05, 2014 at 02:50 PM

The other approach to cross platform is to do your Android and IOS coding in C# using Xamarin.

As long as you keep your library to the limits of what Unity knows, it will work in Unity or native on PC/OSX/Linux/Android/IOS and Unity.

To see an example of a cross platform project done t$$anonymous$$s way, see: http://unseenu.wikispaces.com/AnyGUI

Comment
Add comment · Show 1 · 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
avatar image HarshadK · Jun 05, 2014 at 02:58 PM 0
Share

+1. Yeah. But while using Xamarin, staying in the limits is the main thing you need to remember. And this is one of the reasons why libgdx shifted to libgdx RoboVM backend from Xamarin. Plus there is also the reason of cost involved with Xamarin since not everyone can afford that cost. ;-)

avatar image
0

Answer by HarshadK · Jun 05, 2014 at 11:00 AM

You might find t$$anonymous$$s question on SO of some help: Can I access Java code from Unity?

Comment
Add comment · Show 2 · 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
avatar image Moem · Jun 05, 2014 at 02:34 PM 0
Share

OK, thank you. But do you know if it's going to work on iOS as well? I have tested it on my Android device, and it works, I can access my classes and methods. I can't test it on iOS devices for now...

Thanks! :)

avatar image HarshadK · Jun 05, 2014 at 02:35 PM 0
Share

I'm not sure if it will work or not and I also don't have an iOS device. If you get to try it let us know the outcome for sure. :-)

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

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 do i use typedefs, enums declared in my C plugin .h? 2 Answers

adColony Crashs the 1st time it initializes in iOS. 2 Answers

Social API needs some plugins for Android? 1 Answer

How to integrate a authorize.net android plugin in Unity? 0 Answers

How do I tell Unity to use my updated C plugin? 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