C# - Use public structure in another class


I think this is an easy question for others but I couldn´t figure out how to use a public variable of type structure in another class.

The part where I declare the structure looks like that:

public class SQLDatabase : MonoBehaviour {
	//Structure for my flag images
	public struct FlagInf{
		private long ID;
		private int SortOrder;
		private Texture2D FlagPng;
		public FlagInf (long ID, int SortOrder, Texture2D FlagPng){
			this.ID = ID;
			this.SortOrder = SortOrder;
			this.FlagPng = FlagPng;
	public FlagInf[] Flags = new FlagInf[0];
        //. . . then it comes the rest of the class


After I filled my array Flags I want to use it in another class and tried it like that:

int i=0;
int sortOrder = SQLDatabase.Flags*.SortOrder;* 

Now Unity gives me the Error that SQLDatabase.Flags*.SortOrder can not be used as method or delegate.*
I think a public variable should be able to be used everywhere. Can anyone tell me how I can do this in Unity?
Thank you in advance.

If I’m reading your code correctly, did you try declaring Flags as static? The way it’s declared currently is as an instance field, and you’re trying to access it as a class field.

Your struct fields need to be public or they’re not visible outside of the struct.

public struct FlagInf{
   public long ID;
   public int SortOrder;
   public Texture2D FlagPng;