Problems with coding in sound. Please help !!

This error message pops up when I try to attach sound to doors in there 3 different states, open, closed and locked. I dont know what the error message means though, il post it in full below. It dosnt break the game in any way it just dosnt play the sounds at all, the door still opens and closes the same way. I dont think the code that Iv written is wrong, I could be wrong because I am an inexperienced coder but it seems solid.

This is the error message in full. Any help you could give would be greatly appreciated. Thank you !!

InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Generic.Stack`1[System.Boolean].Pop ()
UnityEditor.EditorGUI.EndDisabledGroup () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:211)
UnityEditor.EditorGUI+DisabledGroupScope.CloseScope () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:197)
UnityEngine.GUI+Scope.Dispose ()
UnityEditor.Editor.OptimizedInspectorGUIImplementation (Rect contentRect) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:234)
UnityEditor.GenericInspector.OnOptimizedInspectorGUI (Rect contentRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/GenericInspector.cs:33)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1211)
UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor editors) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1028)
UnityEditor.InspectorWindow.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:352)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

@OptimisticSoundGuy
Could you please elaborate on “attach sound to doors”? Is the error happening when you add an AudioSource the Door GameObject or when you set the AudioClip of the AudioSource attached to the Door GameObject? You are not trying to attach more than one AudioSource to a door are you?

Have you tried any of the following:

  1. Closed and reopened Unity
  2. Closed Unity, delete the Library folder in the root project folder and reopen Unity (Unity will rebuild the Library folder on startup)

Also, take a look at this DoorManager script
using UnityEngine;
using System.Collections;

public class DoorManager : MonoBehaviour
{
	public AudioClip closedDoorSoundFX;  // set the closed door sound clip
	public AudioClip openDoorSoundFX;    // set the open door sound clip
	public AudioClip lockedDoorSoundFX;  // set the locked door sound clip
	public AudioSource audioSource;      // drop an AudioSource here or one will be added at runtime in the Start() function

	void Start()
	{
	    if (audioSource == null)
	    { // if AudioSource is missing
		    Debug.LogWarning("AudioSource component missing from this gameobject. Adding one.");
		    // let's just add the AudioSource component dynamically
		    audioSource = gameObject.AddComponent<AudioSource>();
	    }
	}
	
	public void PlayClosedDoorSoundFX()
	{
		audioSource.PlayOneShot(closedDoorSoundFX);
	}
	
	public void PlayOpenDoorSoundFX()
	{
		audioSource.PlayOneShot(openDoorSoundFX);
	}
	
	public void PlayLockedDoorSoundFX()
	{
		audioSource.PlayOneShot(lockedDoorSoundFX);
	}
    
    // add script to play sounds here or they can be called in another class
}

First of all thank you for responding and offering help. This is the script that is communicating with the doors at the moment…

Also What does deleating and rebuilding the library folder do to the project, will it affect anything adversely. sorry if its a stupid question, im quite new to all this biz. I miss my microphones, coding makes me sick :L

public class open_doors : MonoBehaviour {

public bool open = false;
public float doorOpenAngle = 90f;
public float doorCloseAngle = 0f; 
public float smooth = 2f;
public bool isLocked = false; 

private AudioSource audioSource;
public AudioClip openingSound;
public AudioClip closingSound;

public AudioClip lockedDoorSound;

void start ()
{
	audioSource = GetComponent<AudioSource> (); 
}

public void ChangeDoorState()
{
	if (isLocked != true) {
		open = !open;

		if (audioSource != null) {
			audioSource.PlayOneShot (openingSound);
		}
	}
	else
	{
		PlaylockedDoorSound ();
	}
}
void PlaylockedDoorSound()
{
	audioSource.PlayOneShot (lockedDoorSound);
}

	void Update () 
{
    if(open) // open == true 
    {
	   Quaternion targetRotationOpen = Quaternion.Euler(0, doorOpenAngle, 0);
	   transform.localRotation = Quaternion.Slerp(transform.localRotation, targetRotationOpen, smooth * Time.deltaTime);
}
else
{
	   Quaternion targetRotationClose = Quaternion.Euler(0, doorCloseAngle, 0);
	   transform.localRotation = Quaternion.Slerp(transform.localRotation, targetRotationClose, smooth * Time.deltaTime);
    }
}

}