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 aleem.razzaq09 · Nov 13, 2012 at 12:52 PM · iosiphone

Open iPhone Native Action sheet in Unity3d

I am new born baby for unity, so i don't know about unity3d basics. Can anyone help me that how can i open native iOS Action sheet in Unity3d with same effect load from bottom to top. Thanks in Advance.

Comment
Add comment · Show 1
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 Fattie · Jul 26, 2013 at 08:28 PM 0
Share

You can't really easily open native iOS action sheets in Unity.

I mean, the guys at Prime31 could spend a few weeks developing such a plug-in that works reliably in big production apps, but it's a stretch.

The general comments below about "plugins in Unity" are not really relevant here

PS funnily enough I just learned (7/2013) that Prime31 now supports iOS Facebook composer and the iOS Facebook share sheet, so as long as their support is enough you're all set.

1 Reply

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

Answer by Montraydavis · Nov 13, 2012 at 12:58 PM

I found something that might be useful to you!

Sure, Unity iPhone Advanced 1.7 supports "plugins" and Unity iPhone 3.0 will also support plugins (in other words, starting with 3.0 you will no longer need Unity iPhone Advanced in order to be able to use that feature).

There's a related question and answer: Specific steps to set up a plugin for iphone in XCode

There's also a couple of vendors that sell Plugins that make it very easy to access many of the iOS features that are not directly supported by Unity. One example would be: Unity 3 iPhone Plugins - Native Made Easy. As these come with full source code, they might also be a good starting point to learn the trade ;-)

EDIT: How to connect Unity scripts with plugins ... it's in the documentation but I only have a local link which wouldn't work for you, so I'm duplicating some of the information here (EDIT2: That documentation is now available online: Unity Manual > Advanced > Plugins - Pro/Mobile-Only Feature, thanks to ForceMagic for the note):

Define your extern method like:

[DllImport ("__Internal")] private static extern float FooPluginFunction();

Hit build in Unity iPhone

Add your native implementation to the generated XCode project's "Classes" folder (this folder is not overwritten when project is updated, but don't forget to backup your native code). If you are using C++ (.cpp) or Objective-C (.mm) to implement the plugin you have to make sure the functions are declared with C linkage to avoid name mangling issues.

extern "C" { float FooPluginFunction(); } Using your plugin from C#

iPhone native plugins can be called only when deployed on the actual device, so it is recommended to wrap all native code methods with an additional C# code layer. This code could check Application.platform and call native methods only when running on the actual device and return mockup values when running in the Editor. Check the Bonjour browser sample application.

Calling C# / JavaScript back from native code Unity iPhone supports limited native->managed callback functionality via UnitySendMessage:

UnitySendMessage("GameObjectName1", "MethodName1", "Message to send"); This function has three parameters : game object name, game object script method to call, message to pass to the called method. Limitations to know:

only script methods that correspond to the following signature can be called from native code :

function MethodName(message:string) calls to UnitySendMessage are asynchronous and have a one frame delay.

-Credit goes to @Jashan Chittesh : source ( http://answers.unity3d.com/users/96/jashan.html - http://answers.unity3d.com/questions/27026/api-integration-for-unity.html )

Comment
Add comment · Show 5 · 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 aleem.razzaq09 · Nov 13, 2012 at 01:13 PM 0
Share

Thanks $$anonymous$$ontray, but It looks like bit complex to play with plugins, i just want to add native action sheet but rest of code same for unity so this will be better to follow this approach. Isn't there any other solution to accomplish this task.

avatar image Montraydavis · Nov 13, 2012 at 01:18 PM 0
Share

As far as I know, you really have no choice. You basically use "plugins" for communicating from iOS to Unity3D . Alternatively, try to search for "NativeToolkit" in the Asset Store. It does this pretty much for you. -Good luck.

avatar image Montraydavis · Nov 13, 2012 at 01:27 PM 0
Share

Just play around with it. I promise it's a lot easier than it looks/sounds.

avatar image aleem.razzaq09 · Nov 19, 2012 at 08:46 AM 0
Share

Thanks $$anonymous$$ontray, i have bit confusion on how to create plugin, can you please share me any code or helping tutorial so that i can follow that. Also i want to share picture on Facebook and Twitter and via $$anonymous$$ail, but this code i've already written in Xcode, so is this possible that i can use this code in unity?

avatar image aleem.razzaq09 · Nov 28, 2012 at 01:28 PM 0
Share

Thanks so much $$anonymous$$ontray, I done this successfully it take bit time but after all saved my a lot time.

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

11 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

Related Questions

Initiating a rich prefab runtime 0 Answers

Adding a Unity 3D view on top of UIKit again 0 Answers

How to Use Activity Indicator in Unity3d 1 Answer

Load image from document directory for iphone 1 Answer

Stop Threads in Unity3d using C# 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