Hi, I’m developing an App that will be on both iOS and Android and was wondering if someone could point me in the direction of how to create a screensaver.
Something along the lines of: if no input has been detected in x time, SetActive(true) screensaver graphic. If input is detected, SetActive (false) screensaver graphic.
I know I could do the latter part with a simple OnClick() function but it’s the start I can’t quite figure out.
1 Answer
1
Ive found a solution that incorporates a Raycast hit detection (as opposed to a mouse click):
public float timeOut = 20.0f; // Time Out Setting in Seconds
private float timeOutTimer = 0.0f;
void Update(){
timeOutTimer += Time.deltaTime;
// If screen is tapped, reset timer
if(Input.GetMouseButtonDown(0)){
timeOutTimer = 0.0f;
//Dont active screensaver
}
// If timer reaches zero, start screensaver
if (timeOutTimer > timeOut){
//Activate Screensaver
}
}
}