Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections.Generic;
- using Vuforia;
- public class FlashlightToggleButton : MonoBehaviour
- {
- IEnumerator Start()
- {
- yield return new WaitForSeconds(2);
- hasTorch = CameraDevice.Instance.SetFlashTorchMode(true);
- yield return new WaitForSeconds(0.001f);
- CameraDevice.Instance.SetFlashTorchMode(false);
- }
- bool torchState = false, hasTouch = false;
- private bool hasTorch;
- void OnGUI()
- {
- if (hasTorch)
- {
- if (GUI.Button(new Rect(0, 0, 170, 140), "Torch"))
- {
- torchState = !torchState;
- CameraDevice.Instance.SetFlashTorchMode(torchState);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement