利用Unity的system.DataTime来判断当前电脑时间,缺陷是更改电脑系统时间会失效。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Jiami : MonoBehaviour {
int i = 0;
// Use this for initialization
void Awake () {
i = PlayerPrefs.GetInt("miwen");
if(i>9)
{
Application.Quit();
}
i++;
PlayerPrefas.SetInt("miwen",i);
}
// Update is called once per frame
void Update () {
if (System.DateTime.Today.Year > 2017 && System.DateTime.Today.Month > 8 && System.DateTime.Today.Day > 9)//限制使用日期2018.09.10日
{
Application.Quit();
}
}
}