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
1
Question by $$anonymous$$ · Aug 30, 2012 at 11:08 AM · pluginxcodedllobjective-c

Can you build iOS plugins using objective-c or only with pure c?

Hey :)

I'm in the proces of learning how to build native iOS plugins for Unity. I already have a lot of experience with objective-c as a language, so no problems there.

The problem is that there does not seem to be that much documentation out there on actually building iOS plugins (besides the official documentations which just shows some really shallow pure c functions build into a plugin).

What I am interested in knowing is if it's possible to build native plugins for iOS using objective-c, or are you forced to using pure C?

For example, could I take this objective-c class and source file:

DialogTest.h

  @interface TestingThis : NSObject
  -(void) ShowDialog;
  @end

DialogTest.m

 @implementation TestingThis
 
 -(void) ShowDialog
 {
     UIAlertView *view = [[UIAlertView alloc] initWithTitle:@"MAO!" message:@"MAO!" delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles:nil];
     
     [view show];
     [view release];
 }
 
 @end

And use it as a plugin in Unity for displaying a native popup? Or would I have to use pure c functions?

I actually already tried to import the above example source code into my Unity xCode project but unfortunately got linker errors when my test script tried to call the ShowDialog() function.

So can anyone shed some light on this? :) Any way to build plugins using pure objective-c?

Comment
Add comment · Show 3
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 fafase · Aug 30, 2012 at 11:21 AM 0
Share

Just remove my answer as I did not notice early enough it was plug-ins you were mentioning. I thought you were just starting and trying to use Objective-C as you saw iOS.

avatar image $$anonymous$$ · Aug 30, 2012 at 11:23 AM 0
Share

aha I see :D Well at any rate thank you for taking the time to read my question and attempting to help out :)

avatar image $$anonymous$$ · Aug 30, 2012 at 02:49 PM 0
Share

Yep, I'm well aware of them :) I am working on a project where we are trying to save money, so we would like to attempt not purchasing them, they do have a steep price when you need several feature packages at once. Since we already have experience with program$$anonymous$$g up against Store$$anonymous$$it, we thought it would be worth a try writing our own plugin ins$$anonymous$$d :)

1 Reply

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

Answer by $$anonymous$$ · Oct 11, 2012 at 10:57 AM

Well, figured it out in the end. You simply have an objective-c class as my example in the original post. What you do is write a C interface which calls the class methods for you, and then you call the C interface functions through Unity. To the flow is Unity method call -> C API -> Class method.

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 Hakimo · Jan 02, 2013 at 05:04 AM 0
Share

Hi PastryGood. I'm curious to know how you got it working. The C interface you said, in the example given at this page, http://docs.unity3d.com/Documentation/$$anonymous$$anual/Plugins.html, it's just a line. When you wrote the interface, do you have to do the normal #include and main functions?

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

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

low level native render plugin Xcode issues 1 Answer

Using NavigationController in an iOS plugin 1 Answer

xCode to Unity communication? 1 Answer

iOS location permission plugin build fails 0 Answers

how do I make a .dll after making a .bundle? 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