Here's my code so far
CUSTOMCLASS.CS
public string[,] tableBR;
string[] strData = {"P ,B ,B ,P ,B ,B ,B ,B ,B ,B ,P ,P ,B ,P "};
public int X_LENGTH = 104;
public int Y_LENGTH = 15;
#region BR VARIABLES
string BigRD= "";
string[] newBigRD;
string realData= "";
#endregion
public Scoreboard(){
tableBR= new string[X_LENGTH,Y_LENGTH ];
}
public void MakeBR(string data){
BigRD = data;
for(int i = 0; i < strData.Length; i++){
BigRD += strData [i];
BigRD += ",";
}
newBigRD= BigRD .Split (',');
foreach(string newData in newBigRD){
realData = newData;
}
}
public string ShowBigRD(){
return realData;
}
public override string ToString(){
return "this are all the data :" + realData.ToString();
}
And here is my main class
MAINCLASS.CS
string BigRD= "";
void Start(){
StartCoroutine ("Win_Log");
}
IEnumerator Win_Log(){
Scoreboard scoreBoard = new Scoreboard();
scoreBoard.MakeBR(BigRD);
Debug.Log ("This is the data : " + scoreBoard.ShowBigRD());
yield return new WaitForEndOfFrame ();
}
It gives me a null string value . It only prints
"this are all the data :"
strData[]is initialised with a single element? What isrealData? Looks like you need to step through this to debug.realData. Use+=instead of just=. Or even better, use a string buildernull. It's probably an empty string since you add a comma to the end ofBigRDso the last item in the loop is going to be an empty string and thus the final value set torealData. The real question is what do you want it to print?