Problem with looping concatenation with custom class

I have an array of objects, a custom class that has an attribute called ‘commentUID.’ I’m trying to output a string that combines the commentUID of each object with a comma in between. However, my script won’t add anything past the first object, and I have no idea why. It’s running through the loop…it’s just not adding the commentUID strings. If I try it with another type of object, like have it add a simple string, it works as expected. Any ideas?

var allComments : commentObj[] = new commentObj[0];

class commentObj { 

	//Use this number to assign the Alr
	private var projectID : int = 1;

	var commentUID : String;

	var user : userInfo;
	var userPos : userPosition;
	
	var target : GameObject;
	var targetPosition : Vector3;
	
	var view : Texture2D;
	var date : System.DateTime = System.DateTime.Now;
	var text : String;
}

	var CommentString : String;
	
	for (var x = 0; x<allComments.Length; x++){
		if(x == 0){
			CommentString = allComments[x].commentUID;
			Debug.Log("Ran Once");
		}
		else{
			CommentString = CommentString + "," + allComments[x].commentUID;
			Debug.Log("Ran " + (x+1) + " times");
		}
	}

Ok, so it looks like it was a problem with the input…I’m not really sure what caused it, though. It was typed to a String, so I wouldn’t expect problems. In any case, fortunately my commentUID (while I treat it like a String) is actually purely numerical. I was able to fix my problem by changing the allComments.x.commentUID into
parseInt(allComments[x].commentUID).ToString()

Why this works, I can’t really say. Something is obviously wrong with my input, but darned if I know what :stuck_out_tongue: