can't set inital values to GUI items

using UnityEngine;
using System.Collections;

public class GUI_scr : MonoBehaviour {
	
	public bool cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cb10;
	public bool[] cbxArr;
	public string player1, player2, player3, player4, player5, player6, player7, player8, player9, player10;
	public string[] playersArr;
	public string score1, score2, score3, score4, score5, score6, score7, score8, score9, score10;
	public string[] scoreArr;


	void Start()
	{
		cbxArr = new bool[]{cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cb10};
		scoreArr = new string[]{score1, score2, score3, score4, score5, score6, score7, score8, score9, score10};
		playersArr = new string[]{player1, player2, player3, player4, player5, player6, player7, player8, player9, player10};

		SetInitialValues(); // this doesn't work for some reason,   
          // all the toggle GUI items look like they were set to false,   
          // even though the debug log shows the values to be set to true.

		cb7 = true; // this works fine, the toggle is visibly set to true.

	}

	void SetInitialValues()
	{
		for(int i = 0; i<cbxArr.Length; i++)
		{cbxArr *= true;}*
  •  for(int i = 0; i<scoreArr.Length; i++)*
    

_ {scoreArr = “0”;}_
* }*

* void OnGUI () {*
* DrawGUI ();*
* }*

* public void DrawGUI()*
* {*
* GUI.BeginGroup (new Rect(0,0,100,768));*
_ /for(int i = 0; i<10; i++)_
_
{_
_ GUI.BeginGroup(new Rect(0,60i, 100,80));
GUI.Box (new Rect(0,0,100,25), playersArr*);
GUI.Box (new Rect(0,25,70,25), scoreArr.ToString ());_

cbxArr _= (GUI.Toggle (new Rect(80,30,300,30),cbxArr,“”));
GUI.EndGroup ();
}/_

* GUI.BeginGroup(new Rect(0,0, 100,80));*
* player1 = GUI.TextArea(new Rect(0,0,100,25), player1);*
* GUI.Box (new Rect(0,25,70,25), score1);*
* cb1 = (GUI.Toggle (new Rect(80,30,300,30),cb1,“”));*
* GUI.EndGroup ();*

* GUI.BeginGroup(new Rect(0,60, 100,80));*
* player2 = GUI.TextArea(new Rect(0,0,100,25), player2);*
* GUI.Box (new Rect(0,25,70,25), score2);*
* cb2 = (GUI.Toggle (new Rect(80,30,300,30),cb2,“”));*
* GUI.EndGroup ();*

* GUI.BeginGroup(new Rect(0,120, 100,80));*
* player3 = GUI.TextArea(new Rect(0,0,100,25), player3);*
* GUI.Box (new Rect(0,25,70,25), score3);*
* cb3 = (GUI.Toggle (new Rect(80,30,300,30),cb3,“”));*
* GUI.EndGroup ();*

* GUI.BeginGroup(new Rect(0,180, 100,80));*
* player4 = GUI.TextArea(new Rect(0,0,100,25), player4);*
* GUI.Box (new Rect(0,25,70,25), score4);*
* cb4 = (GUI.Toggle (new Rect(80,30,300,30),cb4,“”));*
* GUI.EndGroup ();*

* GUI.BeginGroup(new Rect(0,240, 100,80));*
* player5 = GUI.TextArea(new Rect(0,0,100,25), player5);*
* GUI.Box (new Rect(0,25,70,25), score5);*
* cb5 = (GUI.Toggle (new Rect(80,30,300,30),cb5,“”));*
* GUI.EndGroup ();*

* GUI.BeginGroup(new Rect(0,300, 100,80));*
* player6 = GUI.TextArea(new Rect(0,0,100,25), player6);*
* GUI.Box (new Rect(0,25,70,25), score6);*
* cb6 = (GUI.Toggle (new Rect(80,30,300,30),cb6,“”));*
* GUI.EndGroup ();*

* GUI.BeginGroup(new Rect(0,360, 100,80));*
* player7 = GUI.TextArea(new Rect(0,0,100,25), player7);*
* GUI.Box (new Rect(0,25,70,25), score7);*
* cb7 = (GUI.Toggle (new Rect(80,30,300,30),cb7,“”));*
* GUI.EndGroup ();*

* GUI.BeginGroup(new Rect(0,420, 100,80));*
* player8 = GUI.TextArea(new Rect(0,0,100,25), player8);*
* GUI.Box (new Rect(0,25,70,25), score8);*
* cb8 = (GUI.Toggle (new Rect(80,30,300,30),cb8,“”));*
* GUI.EndGroup ();*

* GUI.BeginGroup(new Rect(0,480, 100,80));*
* player9 = GUI.TextArea(new Rect(0,0,100,25), player9);*
* GUI.Box (new Rect(0,25,70,25), score9);*
* cb9 = (GUI.Toggle (new Rect(80,30,300,30),cb9,“”));*
* GUI.EndGroup ();*

* GUI.BeginGroup(new Rect(0,540, 100,80));*
* player10 = GUI.TextArea(new Rect(0,0,100,25), player10);*
* GUI.Box (new Rect(0,25,70,25), score10);*
* cb10 = (GUI.Toggle (new Rect(80,30,300,30),cb10,“”));*
* GUI.EndGroup ();*

* GUI.Button (new Rect(0,700,50,20), “selAll”);*
* GUI.Button (new Rect(50,700,50,20), “next”);*
* GUI.EndGroup();*

* GUI.BeginGroup (new Rect(Screen.width - 90,0,90,768));*
* if(GUI.Button (new Rect(0,0,30, 20), “II”))*
* {*
* PauseGame ();*
* }*
* if(GUI.Button (new Rect(30,0,30,20),“o”))*
* {*
* ResetGame ();*
* }*
* if(GUI.Button (new Rect(60,0,30,20),“x”))*
* {*
* QuitGame ();*
* }*
* GUI.EndGroup ();*

* }*

* void PauseGame()*
* {*
* float timeScale = (Time.timeScale != 0 ? Time.timeScale = 0 : Time.timeScale = 1);*
* }*
* void ResetGame()*
* {*
* Application.LoadLevel (0);*
* }*
* void QuitGame()*
* {*
* Application.Quit ();*
* }*
}

Let me try to simplify it…

Basically you never assign cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cb10 values, so they are false by default.

What you do do however is in your SetInitialValues(), you set all the values of cbxArray to true but you never actually use the array at all.

You use: (Remember you never gave cb1 a value so it will be false)

cb1 = (GUI.Toggle (new Rect(80,30,300,30),cb1,""));

Instead it should be: (Because you gave cbxArr[0] a true value)

cbxArr[0] = (GUI.Toggle (new Rect(80,30,300,30),cbxArr[0],""));

Side Note:

cbxArr = new bool[]{cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cb10};

All this does is give all the array elements the corresponding value of cb.
So what you are doing here is the same as:

cbxArr[0] = cb1;
cbxArr[1] = cb2;
cbxArr[2] = cb3;
cbxArr[3] = cb4;
cbxArr[4] = cb5;
cbxArr[5] = cb6;
cbxArr[6] = cb7;
cbxArr[7] = cb8;
cbxArr[8] = cb9;
cbxArr[9] = cb10;

My suggestion is that you get rid of

public bool cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cb10;
public string player1, player2, player3, player4, player5, player6, player7, player8, player9, player10;
public string score1, score2, score3, score4, score5, score6, score7, score8, score9, score10;

as it does the same as the arrays… So your code should look like:

 using UnityEngine;
using System.Collections;
public class GUI_scr : MonoBehaviour {
public bool[] cbxArr;
public string[] playersArr;
public string[] scoreArr;
void Start()
{
cbxArr = new bool[10];
scoreArr = new string[10];
playersArr = new string[10];
SetInitialValues();
}
void SetInitialValues()
{
for(int i = 0; i<cbxArr.Length; i++)
{cbxArr *= true;}*

for(int i = 0; i<scoreArr.Length; i++)
{scoreArr = “0”;}
}
void OnGUI () {
DrawGUI ();
}
public void DrawGUI()
{
GUI.BeginGroup (new Rect(0,0,100,768));
/*for(int i = 0; i<10; i++)
{
GUI.BeginGroup(new Rect(0,60*i, 100,80));
GUI.Box (new Rect(0,0,100,25), playersArr*);*
GUI.Box (new Rect(0,25,70,25), scoreArr*.ToString ());*
cbxArr = (GUI.Toggle (new Rect(80,30,300,30),cbxArr*,“”));*
GUI.EndGroup ();
}*/
GUI.BeginGroup(new Rect(0,0, 100,80));
playersArr[0] = GUI.TextArea(new Rect(0,0,100,25), playersArr[0]);
GUI.Box (new Rect(0,25,70,25), scoreArr[0]);
cbxArr[0] = (GUI.Toggle (new Rect(80,30,300,30),cbxArr[0],“”));
GUI.EndGroup ();
GUI.BeginGroup(new Rect(0,60, 100,80));
playersArr[1] = GUI.TextArea(new Rect(0,0,100,25), playersArr[1]);
GUI.Box (new Rect(0,25,70,25), scoreArr[1]);
cbxArr[1] = (GUI.Toggle (new Rect(80,30,300,30),cbxArr[1],“”));
GUI.EndGroup ();
//~~~~~~~~~~~~~~~~~
//Rest of code here continue working with arrays
//~~~~~~~~~~~~~~~~~
}
An even more optimized way is to use just use that loop you commented out:
for(int i = 0; i<10; i++)
{
GUI.BeginGroup(new Rect(0,60*i, 100,80));
GUI.Box (new Rect(0,0,100,25), playersArr*);*
GUI.Box (new Rect(0,25,70,25), scoreArr*.ToString ());*
cbxArr = (GUI.Toggle (new Rect(80,30,300,30),cbxArr*,“”));*
GUI.EndGroup ();
}