特殊原因,在Unity 打包后,需要对运行的次数做一定的限制,这里用到C#的注册列表的控制来达到限制的效果
以下代码挂在Unity一个物体里就行了;如果是有切换场景的,记得需要挂在不销毁的物体上
using UnityEngine;
using System.Collections;
using Microsoft.Win32;
public class SetUseTime : MonoBehaviour {
// Use this for initialization
void Start () {
SetPlayUseTime();
}
// Update is called once per frame
void Update () {
}
void SetPlayUseTime()
{
RegistryKey RootKey, RegKey;
//项名为:HKEY_CURRENT_USER\Software
RootKey = Registry.CurrentUser.OpenSubK