Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created June 11, 2016 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/51b83fc7aa04d69a43f2fa6fa13b87ed to your computer and use it in GitHub Desktop.
Save flushpot1125/51b83fc7aa04d69a43f2fa6fa13b87ed to your computer and use it in GitHub Desktop.
Clicking button emulation at 4 sec interval
using System;
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
namespace StructureAR
{
public class AutoScanController : MonoBehaviour {
[SerializeField] Button button;
private float timeOut=4.0f;
private float timeElapsed;
void Update(){
timeElapsed += Time.deltaTime;
if(timeElapsed >= timeOut) {
generateFrameAndDisappear ();
timeElapsed = 0.0f;
}
}
private void generateFrameAndDisappear(){
button.onClick.Invoke ();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment