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 Milena · Jun 20, 2012 at 02:09 PM · cameraiphonelightipad

How to turn on camera light (make a flashlight) on iPhone/iPad?

Hi everyone,

I was wondering if I can turn on camera light on my iPhone? Does Unity support that kind of action?

I found something about that on the internet, but they don't explain anything about the process or java scripting in unity, and i also didn't find anything in script references.

Thanks

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 Milena · Jun 25, 2012 at 10:34 AM 0
Share

I sent e-mail to people from prime31 and i'll see what they say... I know that this subject is very advanced, but i'll have to learn it eventually :) Thanks for the advice!

2 Replies

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

Answer by whydoidoit · Jun 20, 2012 at 09:49 PM

Vuforia's CameraDevice supports turning on the camera light on the iPhone, ut might be a bit of overkill :) - But it is free.

http://www.qualcomm.com/solutions/augmented-reality

Comment
Add comment · Show 6 · 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 Milena · Jun 25, 2012 at 10:38 AM 0
Share

Hey $$anonymous$$ike, i downloaded that plugin and it has lots of stuff, so i will see if i can "isolate" only what i need. When I get to my answer I will post it on this topic! Sorry about the iPad in my question, it was "automatic mistake" :)

Thanks a lot for your help, this forum has always been most helpful!

avatar image whydoidoit · Jun 25, 2012 at 10:56 AM 0
Share

It's CameraDevice.Instance.SetFlashTorch$$anonymous$$ode(true); :)

avatar image Milena · Jun 25, 2012 at 03:34 PM 0
Share

$$anonymous$$ike, I just spent a lot of time reading all of those scripts that i downloaded. In my project I used only two of them, one is CameraDevice that is attached to $$anonymous$$ain Camera. I took only this: bool result = cameraDeviceSetFlashTorch$$anonymous$$ode(on ? 1 : 0) != 0; )

And second is, very short, QCAR$$anonymous$$acros for platforms. I made simple ON/OFF button.

I built it and the build succeeded, but it just won't run it on my iPhone. It says:

Unable to resolve pinvoke method 'CameraDevice:cameraDeviceSetFlashTorch$$anonymous$$ode (int)' Re-run with $$anonymous$$ONO_LOG_LEVEL=debug for more information.

Do you now what else should I add in my project, maybe some .dll file, i don't know?

P.S. I didn't use "Instance" cause it kept giving me error. So I put together everything in one script.

Thanks!

avatar image whydoidoit · Jun 25, 2012 at 10:26 PM 0
Share

Hmmm, that's odd - sometimes QCAR has a problem with the update of your XCode project (especially if you use it with some other plugins). I have to say I haven't tried it in a few months. If you IOS project is building - perhaps it's broken in Vurforia...

avatar image Milena · Jun 26, 2012 at 11:52 AM 1
Share

I managed to make it work! I just had to import much more scripts in my project 'cause they all depend on each other.

Thanks a lot $$anonymous$$ike for the link, Vuforia package really has everything for the camera, zoom, focus, torchlight...

Thanks!!!

Show more comments
avatar image
0

Answer by hellobard · Sep 12, 2012 at 09:52 PM

Hey Milena, Could you possible share how you set up the button on / off and called up the Qualcomm script? bit of a noob here, but I'd love to learn from how you made it work!

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 hellobard · Dec 16, 2012 at 11:53 AM 0
Share

just wanted to add to this thread if anyone else should be in use of this information like I did:

To make this work, I had to put the Qualcomm Vuforia folder of the project into my Plugins folder to make the script accessible through JS. I then used FingerGestures (in my case) with a function OnTap and just added this line of code: CameraDevice.Instance.SetFlashTorch$$anonymous$$ode(true);

Works perfectly on iOS. Will have to try this on Android too.

avatar image Thanitsak · Jan 14, 2017 at 08:56 AM 0
Share

Could you please tell me, where can I get that Qualcomm Vuforia, as I know right now you need to get the plugin so you can use CameraDevice.Instance.SetFlashTorch$$anonymous$$ode(true); right? $$anonymous$$uch appreciate and thank you very much in advance!

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

7 People are following this question.

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

Related Questions

How to turn on camera light on iPhone? 0 Answers

iPhone StoreKit implementation problem 2 Answers

GameObjects appear different on device than on Unity3d Player 2 Answers

How do you make an iPhone Game with Unity? 4 Answers

iPad touch scripting... 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