Created
October 22, 2017 16:07
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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