.test is a field but a type was expected

Unity throws me 3 errors

1 test is a field but a type was expected
2 the best overloaded method match for ".label has some invalid arguments
3 cannot convert object experssion to type string

I am trying to get data back from my datbase itterating trough all the values stored inside.

    public string test = "";
public string testing = "";
public int AtrribCounter = 0;

private IEnumerator CountMaxAttributesUsed() {

	var bucket = new Bucket("Database Attribute & Vital Setup");
	
	var bucketData = new BucketData {Bucket = bucket};

            // Get a list of all keys in the bucket.
            var getKeysReq = bucket.GetKeys();
            yield return getKeysReq.WaitUntilDone();

				   // Build a new list of keys in the bucket.
            		bucketData.Entries = new List<Entry>();
            		
					foreach (var key in getKeysReq.GetKeyEnumerable())
            		{	
						//gets the number of total keys under said bucket
						AtrribCounter++;
					}
	//itterates trough each key and combines attribute string with the value
	for(int cnt = 0; cnt < AtrribCounter; cnt++) {

		var DataList = bucket.Get("Attribute " + cnt);
	
		yield return DataList.WaitUntilDone(); 
	
		Debug.Log("Wrote one value and got a reply. Success = " + DataList.isSuccessful); 
	       
		test = DataList.GetValue<string>();
	}
}

then under OnGUI my code that prints it on the screen is

for(int cnt = 0; cnt < AtrribCounter; cnt++) {

GUI.Label(new Rect(0, 90 + (cnt * 25), 125, 25), ("Attribute " + cnt));

GUI.Label(new Rect(125, 90 + (cnt * 25), 125, 25), (test)cnt);
			}

the moment i add cnt after the (test) it throws the errors, if i leave cnt out i see it going trough all the correct values but then prints out only the last string multiple times.

Are you writing C# or JS? The first lines are C#, and they should be inside a class declaration like below. Then some JS instructions appear: the keyword var is used in JS variable declarations, variables are declared in C# with the type first, then the name. You then return to C# with a foreach instruction - it’s just for in JS.

Definitely, you must choose one language to write your script!

using UnityEngine;

public class MyScriptName : MonoBehaviour {
  public string test = "";
  public string testing = "";
  public int AtrribCounter = 0;

  private IEnumerator CountMaxAttributesUsed() {
    // this is JS!
    var bucket = new Bucket("Database Attribute & Vital Setup");
    // it should be something like this in C#:
    Bucket bucket = new Bucket(...);
    ...

Its not actually the ("Attribute " + cnt), use ("Attribute " + cnt.ToString()) part that gives errors but the combination of getting a value from the database put into the string test then attaching cnt to count trough the keys and display them, without cnt to count trough them i see it rush trough them and then display the end result in all x GUI printouts on the screen, it stops working the moment i add cnt to it.

test = DataList.GetValue(); ->> GUI.Label(new Rect(125, 90 + (cnt * 25), 125, 25), (test)cnt); ← the cnt part wont fly :confused: and is needed to print out each value in correct order.

thanks for the help so far.