- Home /
How do I resume a script after pausing? [Vuforia issue]
I am working on an app for android. I use the Handheld.PlayFullScreenMovie which pauses the app to play the video. However when the app returns the camera will no longer auto-focus.
I am using this script on my camera.
using UnityEngine;
using System.Collections;
public class Autofocus : MonoBehaviour {
private bool EnableAutofocus = false;
// Use this for initialization
void Start() {
EnableAutofocus = true;
}
// Update is called once per frame
void Update () {
if (EnableAutofocus) {
bool success = CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);
if (success) {
Debug.Log("Successfully set the continuous autofocus");
}
else {
Debug.Log("Unable to set the continuous autofocus");
}
EnableAutofocus = false;
}
}
}
After pausing the camera runs however the script does not seem to reload.
How do I make sure this script runs when the app starts up again?
I am also using the vuforia sdk if that matters?
Answer by Giantbean · Nov 18, 2013 at 05:22 PM
This seems to be a vuforia issue in my case.
https://developer.vuforia.com/forum/ios/camera-loses-auto-focus
They don't have a fix yet so I just added a UI button that sets auto focuses on devices that can handle it and manually focuses on devices that lack continual auto focus and reactivate it on devices that can handle it.
If I called the script after a 5 second pause (seams like a long time on a mobile app) it may work but a simple onscreen button is working for now.
Your answer
Follow this Question
Related Questions
Cloud recognition in Vuforia 0 Answers
how to embed Unity project inside my iOS project 0 Answers
OCR Number Recognition 1 Answer
Using Vuforia, ITrackableEventHandler only triggers on 1 image, not any image. 0 Answers
How to control an Vuforia AR character using the Third Person Controller in Unity? 1 Answer