| 12345678910111213141516171819202122232425 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class StopApplicationFromConfig : MonoBehaviour
- {
- public ConfigReader Config;
- private float totaltime;
- private float currenttime = 0f;
- void Start()
- {
- totaltime = Config.configuration.SimulationTime;
- }
- private void Update()
- {
- currenttime += Time.deltaTime;
- if (currenttime > totaltime)
- {
- // stop the application (does not work in the Editor, only for builds)
- Application.Quit();
- }
- }
- }
|