# Protection Level error message

**URL:** https://discussions.unity.com/t/protection-level-error-message/515707
**Category:** Scripting
**Created:** [September 24, 2013, 7:48am UTC](https://discussions.unity.com/t/protection-level-error-message/515707 "2013-09-24T07:48:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Kovenant\_1](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kovenant_1/32/266479_2.png) [@Kovenant\_1](https://discussions.unity.com/u/Kovenant_1)
#### Post date: [September 24, 2013, 7:48am UTC](https://discussions.unity.com/t/protection-level-error-message/515707/1 "2013-09-24T07:48:55Z")

</div>

Hi!

I get this error message when trying to compile my scripts:  
**Assets/MainMenu.cs(53,36): error CS0122: `SceneFadeIn.EndScene()’ is inaccessible due to its protection level**

Some of my code in MainMenu.cs:

```auto
public SceneFadeIn sceneFader;

........

void DoMainMenu(int windowID)
{
		if(GUILayout.Button("New Game"))
		{
			sceneFader.EndScene();
		}
}

```

Nothing should be wrong with this code since I have done similiar tasks before… So, how do I change the “protection level” of a script??

---

<div class="post-metadata">

### Author: ![fffMalzbier](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/fffmalzbier/32/166694_2.png) [@fffMalzbier](https://discussions.unity.com/u/fffMalzbier)
#### Post date: [September 24, 2013, 9:08am UTC](https://discussions.unity.com/t/protection-level-error-message/515707/2 "2013-09-24T09:08:10Z")

</div>

The function “EndScene” in the class “SceneFadeIn” is probably private or protected. It needs to be public if you like to access it from outside of the own class.

```auto
public SceneFadeIn: MonoBehaviour {
    public void EndScene()
    {
        //your code
    }
}

```
