Hi,
We are facing Flash light toggle issue.
First we are finding is the device has flash functionality or not using
hasTorch=CameraDevice.Instance.SetFlashTorchMode(true);
Always it returns false and displaying debug.log as Toggle flash On Failed even my devices has flash lights (checked in 3 devices (asus5,moto g 2 , Alcatel one touch)).
How to toggle Flash ?
can anyone suggest ?
Thanks in advance.
here is piece of code which i have written :
IEnumerator Start(){ hasTorch=CameraDevice.Instance.SetFlashTorchMode(true); yield return new WaitForSeconds(0.001f); CameraDevice.Instance.SetFlashTorchMode(false); } bool torchState=false,hasTouch=false; void OnGUI(){ if(hasTorch){ if(GUI.Button(new Rect(0, 0, 140, 130),"Torch")) { torchState = !torchState; CameraDevice.Instance.SetFlashTorchMode(torchState); } } }
Finally Its Resolved after some hit and trials.
Given 2 seconds of yield time to check the Flash Light after initializing the QCAR.
Note: Torch button will display only when your device has Flash.