[ExecuteInEditMode()]
をクラスの属性に付けておく。
こんな感じ。
using UnityEngine;
using System.Collections;
[ExecuteInEditMode()]
public class GUIButton : MonoBehaviour {
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
void OnGUI()
{
if (GUI.Button(new Rect(10, 10, 200, 20), "Button"))
{
//クリック時
}
}
}
すると編集中にもボタンが現れる。
0 件のコメント:
コメントを投稿