- Sort Posts
- 12 replies
- Last post
Turn on Flash as light
Turn on Flash as light
Turn on Flash as light
Hello naveenahsn,
AlessandroB's post gives the following API call: CameraDevice.Instance.SetFlashTorchMode( true / false ); This function will turn on or off the flashlight depending on whether you pass true or false.
Could you clarify what detailed instructions you are still looking for please?
Thanks,
-Vuforia Support
Turn on Flash as light
Turn on Flash as light
Do you have any other code calling ToggleLight()? Based on that code alone it would only ever turn the flashlight off. I confirmed that the function CameraDevice.Instance.SetFlashTorchMode correctly enables and disables the flashlight by hooking it up to a button in the sample project.
Thanks,
-Vuforia Support
Turn on Flash as light
I'm trying to toggle the devices flashlight like this (based on AlessandroB's reply):
void Awake () {
mFlashEnabled = false;
toggleLight = new UnityAction (ToggleLight);
}
void ToggleLight(){
if (!mFlashEnabled){
CameraDevice.Instance.SetFlashTorchMode(true);
mFlashEnabled = true;
}
else{
CameraDevice.Instance.SetFlashTorchMode(false);
mFlashEnabled = false;
}
}
I've tested this in IOS and Android but it does not work on either device.
Hi, may i ask where should i put
CameraDevice.Instance.SetFlashTorchMode ( true / false )
I'm sorry i really dont know how to code, should i make a new c# script containing
CameraDevice.Instance.SetFlashTorchMode ( true / false )
and attach it to a button?