Skip to content

Instantly share code, notes, and snippets.

@Buravo46
Last active August 29, 2015 13:56
Show Gist options
  • Save Buravo46/8845412 to your computer and use it in GitHub Desktop.
Save Buravo46/8845412 to your computer and use it in GitHub Desktop.
【Unity】GUI.Buttonを使ったLifeの表示。
using UnityEngine;
using System.Collections;
public class LifeScript : MonoBehaviour {
public int life = 3;
public GUISkin skin;
public GUIContent contents;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI(){
GUI.skin=skin;
for(int i = 1; i <= life; i++){
// new Rect(x, y, width, height)
GUI.Button(new Rect (30*i,10,20,20), contents);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment