Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using System.Collections.Generic;
  6. using Vuforia;
  7.  
  8. public class FlashlightToggleButton : MonoBehaviour
  9. {
  10. IEnumerator Start()
  11. {
  12.  
  13. yield return new WaitForSeconds(2);
  14.  
  15. hasTorch = CameraDevice.Instance.SetFlashTorchMode(true);
  16. yield return new WaitForSeconds(0.001f);
  17. CameraDevice.Instance.SetFlashTorchMode(false);
  18. }
  19.  
  20. bool torchState = false, hasTouch = false;
  21. private bool hasTorch;
  22.  
  23. void OnGUI()
  24. {
  25. if (hasTorch)
  26. {
  27. if (GUI.Button(new Rect(0, 0, 170, 140), "Torch"))
  28. {
  29. torchState = !torchState;
  30. CameraDevice.Instance.SetFlashTorchMode(torchState);
  31.  
  32. }
  33. }
  34.  
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement