Skip to content

Instantly share code, notes, and snippets.

@afandiyusuf
Created October 22, 2017 16:07
Show Gist options
  • Save afandiyusuf/dff2f8c2681a29dd5b56a85d0f819426 to your computer and use it in GitHub Desktop.
Save afandiyusuf/dff2f8c2681a29dd5b56a85d0f819426 to your computer and use it in GitHub Desktop.
Script untuk pengaturan focus manager pada unity3d dan vuforia. Add script ini di focus button yang ada collidernya
using UnityEngine;
using Vuforia;
public class FocusManager : MonoBehaviour {
private void Start()
{
BackToAuto();
}
//prevent to invoking many times;
bool invoking = false;
void OnMouseDown()
{
//focussing camera
CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_TRIGGERAUTO);
if (!invoking)
{
Invoke("BackToAuto", 3);
invoking = true;
}
}
//back to autofocus
void BackToAuto()
{
invoking = false;
CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment