using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ButtonC : MonoBehaviour {

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	//每帧都执行
	void OnGUI()
	{
		if (Time.time%2 < 1) {
			
			if (GUI.Button(new Rect(10,10,120,100),"TestButton")) {
				print ("与君初相识,犹如故人归!");
			}
			
		}
	}
}


OnGUI每次都调用:unity官方文档