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

2 Answers

2

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

It's CameraDevice.Instance.SetFlashTorchMode(true); :)

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...

I tried this and it threw a bunch of namespace errors.

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!

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.SetFlashTorchMode(true); Works perfectly on iOS. Will have to try this on Android too.

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.SetFlashTorchMode(true); right? Much appreciate and thank you very much in advance!