By javck
on Mon, 09/02/2013 - 06:58
Hello,
I set device's focusmode to continuousauto,and it's work great.The code lists below
public class CameraFocusSetting : MonoBehaviour,ITrackerEventHandler { public bool mContinousAFSupported = true; private CameraDevice.FocusMode mFocusMode = CameraDevice.FocusMode.FOCUS_MODE_NORMAL; // Use this for initialization void Start () { QCARBehaviour qcarBehaviour = (QCARBehaviour)FindObjectOfType(typeof(QCARBehaviour)); if (qcarBehaviour) { KGFDebug.LogDebug("Register Success!","QCAR.TrackerEventHandler"); qcarBehaviour.RegisterTrackerEventHandler(this); }else{ KGFDebug.LogError("Register Fail!","QCAR.TrackerEventHandler"); } } // Update is called once per frame void Update () { } void ResetFocusMode(){ if(CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO)){ KGFDebug.LogDebug("FOCUS_MODE_CONTINUOUSAUTO","QCAR.TrackerEventHandler"); mFocusMode = CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO; mContinousAFSupported = true; }else{ KGFDebug.LogDebug("FOCUS_MODE_NORMAL","QCAR.TrackerEventHandler"); Debug.LogError("could not switch to continuous autofocus"); mContinousAFSupported = false; mFocusMode = CameraDevice.FocusMode.FOCUS_MODE_NORMAL; } } #region ITrackerEventHandler_Implementation public void OnInitialized () { KGFDebug.LogDebug("OnInitialized","QCAR.TrackerEventHandler"); ResetFocusMode(); } public void OnTrackablesUpdated () { //not used Debug.Log("OnTrackablesUpdated"); } #endregion ITrackerEventHandler_Implementation }
But when I click a button to call android's native function in order to open android's webview and close it ,the device can't auto focus anymore.
Please give me some advice to reset the focusmode or how to fix it.
Thanks all!
Auto Focus stop when back from android's webview
Hi, can you please post this question (which is Unity specific) in the Unity section of our Forum ?
Auto Focus stop when back from android's webview
ok!
Auto Focus stop when back from android's webview
Link to the new post
Auto Focus stop when back from android's webview
The question below is Unity-related as it has Unity code as you can see. We simply try to keep some order by directingthreads to where they best fit.
Concerning these two threads:
Auto Focus stop when back from android's webview
Yes it is Unity code but the issue may be in the CameraDecive.cs code and it is Unity/Android specific as the focuse is failing on an android device. So I was just wondering about sending it to a new location.