So, I decided I was going to test out my loot window, but for some reason when i click inside the scroll part, it will not scroll down at all!
here is the code:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class LootWindow : MonoBehaviour {
public GUIStyle EButton; // 20 by 20
public GUIStyle LootWindowGUI;
//LootWindow orientated
public const int LootWindowID = 0;
public Rect LootWindowRect = new Rect(0,0,0,0);
public List<ItemDataBase> LootItems;
public Vector2 WindowSlider = Vector2.zero;
void Start () {
LootItems = new List<ItemDataBase>();
Populate();
}
void OnGUI(){
LootWindowRect = GUI.Window(LootWindowID,new Rect(Screen.width/2-100,Screen.height/2-200,200,300),LootWindowOpen,"Loot Window",LootWindowGUI);
}
public void LootWindowOpen(int id){
WindowSlider = GUI.BeginScrollView( new Rect(10,45,LootWindowRect.width - 10, 300),WindowSlider,new Rect(15,18,LootItems.Count *60,10 *60));
for(int i=0; i < 3; i++){
for( int y =0; y < 10; y++){
GUI.Button(new Rect(10+(i * 60),20 +(y * 60),60,60),"T" + (i + y * 5));
}
}
GUI.EndScrollView();
}
public void Populate(){
for(int i=0; i < 20; i++){
LootItems.Add( new ItemDataBase());
}
}
}