How to keep AR Camera awake when the scene is running? (To avoid closing the app when phone goes into sleep mode)

0 votes
asked Jan 10, 2018 by kydzear (200 points)

1 Answer

+1 vote
answered Jan 11, 2018 by albert52 (31,850 points)
1.In another way, you can add a piece of code to your app to avoid the sleep mode.

2.Do you have a power-saving mode?

3.Do you have the ability to unlock the "lock screen" of security software?
commented Jan 12, 2018 by kydzear (200 points)
Creating a script solved the issue. Thanks a lot for giving advice.
commented Jan 16, 2018 by andresherrera (110 points)
Hi, can you help me?

1. How did you do the code?

2. Where should I locate the code?

I'm a noob

Thank you very much.
commented Feb 9, 2018 by dharm11gohil (250 points)
What type of code need to be added in-app to avoid the sleep mode.
commented Feb 11, 2018 by kydzear (200 points)
(1). Create a C# script
(2). Paste this in the script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SleepMode : MonoBehaviour {
    void Start()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
    }

    // Update is called once per frame
    void Update()
    {

    }
}

(3). Attach the script to AR Camera.
commented Feb 12, 2018 by dharm11gohil (250 points)
It's Work!

Thank you so much for the help.
commented Feb 28, 2018 by tonicg (110 points)
Thanks so much for this help too.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...