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 deltron1830 · Mar 24, 2014 at 05:00 PM · iospluginc++box2d

Getting a plugin working on iOS

I'm using this physics library written in C++ in my game. I've written a plugin for it for windows and Android. I've achieved this by building the library for the target device into .dll and .so files and including a new .cpp file with the extern 'C' functions that I can call from Unity C#

Now I'm trying to get it working on iOS. It seems a lot harder to do this. I'm hoping someone whos done this before can advise me on which option to take and whether I am on the right track. I'm looking at two options.

1) Use the 'Automated plugin integration' This involves putting the source .ccp and .h files into the Assets\Plugins\iOS folder. Unfortunately it does not support subfolders so my plan is to flatten the directory structure of the whole library so I can put everything in one folder. My idea to do this is to use a python script that will change all the include statements in the source code so for example..

     #include <Box2D/Common/b2Settings.h>  

   

would be changed to..

     #include <b2Settings.h>  

Note: This library is a superset of Box2D so its relatively large and complex. Also I'm a bit worried about this as there have been reports from 2013 on stack overflow saying that the Automated plugin integration for iOS has been broken since unity 4

2) Build to a .a file and use it the same way I have done with windows and Android. The project already comes with an xcode project for building to OSX. I might be able to change the build target to iOS, though I gather that I would have to add a .h file with my external 'C' functions.. Also the documentation / example they give is confusing me. They dont use this method and only seem to include the source code files in assets so I'm not sure if this method is even possible.

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
0
Best Answer

Answer by deltron1830 · Mar 27, 2014 at 05:47 PM

Ok, So method 1 actually worked! The performance was terrible on an iphone 4 but absolutely flawless on a iphone 5. The only other issue I had was I had to turn

   #include <Box2D/Common/b2Settings.h>

into

   #include  "b2Settings.h"  

Xcode didnt like the pointy brackets. Also this failed to build on the simulator but worked on an actual device

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

20 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

Related Questions

iOS Plugin - Pass a struct from C++ to C# 1 Answer

IL2CPP C# passed ref float[] to C++ can't get right result 1 Answer

Can I code a native plugin for iOS in C/C++? 0 Answers

Creating a native photo picker screen on iOS 2 Answers

Compiling plugin for iOS - need more info. 4 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