Skip to content

Instantly share code, notes, and snippets.

@gluschenko
Last active August 26, 2015 20:39
Show Gist options
  • Save gluschenko/ede01471ce4db7474fc3 to your computer and use it in GitHub Desktop.
Save gluschenko/ede01471ce4db7474fc3 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Test : MonoBehaviour {
List<GameObject> people = new List<GameObject>();
Vector2 ScrollPos = new Vector2(0, 0);
void Start () {
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
people.Add (new GameObject());
}
void Update () {
}
void OnGUI()
{
GUI.Box (new Rect(0, Screen.height - 90, Screen.width, 90), "");
GUILayout.BeginArea(new Rect(0, Screen.height - 90, Screen.width, 90));
ScrollPos = GUILayout.BeginScrollView(ScrollPos);
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
for(int i = 0; i < people.Count; i++)
{
GameObject p = people[i];
if(GUILayout.Button("Obj_" + i, GUILayout.Height(60), GUILayout.Width(60)))
{
foreach(GameObject ap in people)ap.GetComponent<Aborigen>().chosen = false;
//p.choosen = true;
}
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
GUILayout.EndArea();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment