- Sort Posts
- 8 replies
- Last post
[HELP] Device flash light
April 10, 2013 - 5:44pm #1
[HELP] Device flash light
October 18, 2017 - 1:56am #9
[HELP] Device flash light
October 10, 2013 - 1:26pm #7
This thread is about Unity, not native SDK.
Anyway, if you check the API reference, you'll see that you can use the setFlashTorchMode() method of the CameraDevice class.
https://developer.vuforia.com/resources/api/class_q_c_a_r_1_1_camera_device
[HELP] Device flash light
April 17, 2013 - 5:54pm #3
[HELP] Device flash light
April 10, 2013 - 6:09pm #2
Here you go..
// Turn flash on or off. if (GUILayout.Button("Toggle Flash", buttonGroupStyle)) { if (!mFlashEnabled) { // Turn on flash if it is currently disabled. CameraDevice.Instance.SetFlashTorchMode(true); mFlashEnabled = true; } else { // Turn off flash if it is currently enabled. CameraDevice.Instance.SetFlashTorchMode(false); mFlashEnabled = false; } mMenuToShow = MenuMode.MENU_OFF; mButtonPressed = true; }
That code can go in the OnGUI method of a script that inherits from MonoBehaviour, and you also need to add the following member variable to store the state of the flash so that it can be toggled..
// Check if flash is currently enabled. private bool mFlashEnabled = false;
The button style can be defined as such..
// Setup style for buttons. GUIStyle buttonGroupStyle = new GUIStyle(GUI.skin.button); buttonGroupStyle.stretchWidth = true; buttonGroupStyle.stretchHeight = true;
how to put that script please give me instruction