Search Unity

overlapping selections when the content in selection grid is based on database?

Discussion in 'Scripting' started by [DJ]Creepz, Sep 4, 2012.

  1. [DJ]Creepz

    [DJ]Creepz

    Joined:
    Dec 23, 2011
    Posts:
    136
    i have a connection to my mysql database..i'm accessing my player_tbl..now I'd use selection grid to display the player profiles from the player_tbl.. everything is fine because the profiles are only 3 but when i added more than 3 profiles, the selections overlap each other making the string content of the selection unreadable.. how can i fix it?

    here's the code
    Code (csharp):
    1.  
    2.     private static MySqlConnection dbConnect;
    3.     private static string[] profiles;
    4.     private string[] profiler;
    5.     private int profileCount;
    6.  
    7.     private int selProfNumber = 0;
    8.     private string[] selProfName;
    9.  
    10.     void Start () {
    11.         openSqlConnection();
    12.         profileCount = doProfile("SELECT PlayerID FROM player_tbl");
    13.         profiles = new string[profileCount];
    14.         profiler = new string[profileCount];
    15.         doQuery("SELECT Name FROM player_tbl");
    16.         selProfName = new string[profileCount];
    17.         Starting();
    18.     }
    19.  
    20.     void Starting(){
    21.         for(int cnt=0;cnt<profileCount;cnt++){
    22.             profiler[cnt] = profiles[cnt];
    23.             selProfName[cnt] = profiles[cnt];
    24.         }
    25.     }
    26.  
    27. //i don't know if in this part is the problem
    28.     void OnGUI(){
    29.         GUI.skin = myskin;
    30.        
    31.         scrollPos = GUI.BeginScrollView(new Rect((Screen.width/2) - 230,(Screen.height/2) - 100,450,350),scrollPos,new Rect(0,0,400,800));
    32.         selProfNumber = GUI.SelectionGrid(new Rect(100,60,250,70),selProfNumber,selProfName,1);
    33.         GUI.EndScrollView();
    34.     }
    35.  
    36.