Can't access variable due to its protection level?

I know this means public versus private in most cases however, I do not see the issue here. This is a script to determine the appropriate “Classification” depending on the time and connections made. There are 4 possible ranks. From high to low, Legendary, Epic, Excellent, and Good. Each of these have a “goal” time and connections made. For example, to achieve Legendary. You need to make 10 connections, in under 12 seconds. And to achieve Epic, you must make 8 connections in 15 seconds. However, if you make 10 connections, in 13 seconds… that is no longer qualified for Legendary since it took you too long. So you will drop down a class, to Epic. The goal is to get the most connections in the least amount of time. If the connections made and time qualify lower than Excellent, it will give you Good by default. Here is the script that I have, It seems to be working but I can’t test it until I fix this error. LevelExit.CombinedScore.scoreName’ is inaccessible due to its protection level.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class LevelExit : MonoBehaviour
{

    public float padding;
    public GUIStyle myStyle;

    public string classification = "";
    public int connections = 0;
    public float time = 0.0f;

    void Awake()
     {
         GameObject levelIntro = GameObject.Find("Level Introduction");
         LevelIntroduction levelIntroScript = levelIntro.GetComponent<LevelIntroduction>();
				 
         int curConnections = GameLogic.getTotalConnections();
         float curTime = GameLogic.getTotalTime();
				 CombinedScore playerScore = new CombinedScore("Player", curConnections, curTime);
				 
				 /// Here we initialize all the score values.  
         CombinedScore legendaryScore = new CombinedScore("Legendary",
                 levelIntroScript.LegendConnect,
                 levelIntroScript.LegendTime);
         CombinedScore epicScore = new CombinedScore("Epic",
                 levelIntroScript.EpicConnect,
                 levelIntroScript.EpicTime);
         CombinedScore excellentScore = new CombinedScore("Excellent",
                 levelIntroScript.ExcellentConnect,
                 levelIntroScript.ExcellentTime);
         CombinedScore goodScore = new CombinedScore("Good",
                 levelIntroScript.GoodConnect,
                 levelIntroScript.GoodTime);
								 
				 /// Now put them all in a list, in order				 
         List<CombinedScore> referenceScoresFromHighToLow = new List<CombinedScore>() { legendaryScore, epicScore, excellentScore, goodScore };
					
				 /// Then pass in the player's score along with the list, so it can compare them	
				 classification = GetScoreClassification(playerScore, referenceScoresFromHighToLow);	
     }


    public struct CombinedScore
    {
        int connections;
        float time;
        string scoreName;

        public CombinedScore(string name, int conns, float t)
        {
            scoreName = name;
            connections = conns;
            time = t;
        }
    }

    string GetScoreClassification(CombinedScore playerScore, List<CombinedScore> referenceScoresFromHighToLow)
    {
        foreach (CombinedScore score in referenceScoresFromHighToLow)
        {
            if (isBetterScore(playerScore, score))
            {
                /// If it is a better score it returns the value, breaking out of the loop early.
                return score.scoreName;
                    
            }
        }

        /// The value if it doesn't beat any of the reference scores
        return "Terrible";
    }

    bool isBetterScore(CombinedScore playerScore, CombinedScore referenceScore)
    {
        if (playerScore.connections >= referenceScore.connections && playerScore.time <= referenceScore.time)
        {
            return true;
        }
        return false;
    }

    void OnGUI()
    {

        //Get the number of the current level. Since the range from 0, 1, 2+
        //Add 1.
        int level = Application.loadedLevel + 1;

        GUI.Label(new Rect((Screen.width / 2) - (125 / 2), (Screen.height / 2) - (125 / 2) + padding + 25, 125, 25), "Level " + level.ToString(), myStyle);

        ///If you want to update this in real time, you can call GetScoreClassification right here!
        GUI.Label(new Rect((Screen.width / 2) - (125 / 2), (Screen.height / 2) - (125 / 2) + padding, 125, 25), "Classification: " + classification, myStyle);
        GUI.Label(new Rect((Screen.width / 2) - (125 / 2), (Screen.height / 2) - (125 / 2) + padding - 25, 125, 25), "Connections: " + GameLogic.getTotalConnections(), myStyle);
        GUI.Label(new Rect((Screen.width / 2) - (125 / 2), (Screen.height / 2) - (125 / 2) + padding - 50, 125, 25), "Time: " + (int)GameLogic.getTotalTime(), myStyle);

    }

}

Well, your 3 variables in your “CombinedScore” struct are all private … The default visibility in C# is private. If you want them to be accessible from outside the struct, make them public.

You have declared scoreName as private. (C# defaults to private if you don’t specify an access modifier).

CombinedScore is a struct that is separate object from LevelExit. Hence LevelExit cannot access private variables of CombinedScore. Neither can CombinedScore access private variables of LevelExit.

Fix by declaring scoreName as public.