The name `musicOBJ' does not exist in the current context

Tengo un error que me indica que el valor musicOBJ no existe
Que puedo hacer? Como información extra este error se ha producido tras haber hecho ingenieria inversa y que el error ocurre en el script que utilizo para manejar las preferencias mute entre alguna otra.

Imagen del error:

Codigo de error y mensaje de error: CS0103 The name `musicOBJ’ does not exist in the current context
Este es el codigo problematico:

using UnityEngine;

public class SavedPreferencesManager : MonoBehaviour
{

private int mutedMusic;

private int mutedSound;

private int highScore;

private int tutorialComplete;

private int ageGateComplete;

private bool isDataDirty;

private VolumeMutingManager vol;

private playerScript playerS;

public bool sound
{
	get
	{
		return mutedSound == 1;
	}
	set
	{
		bool flag = mutedSound == 1;
		if (value != flag)
		{
			isDataDirty = true;
			mutedSound = (value ? 1 : 0);
		}
	}
}

public bool music
{
	get
	{
		return mutedMusic == 1;
	}
	set
	{
		bool flag = mutedMusic == 1;
		if (value != flag)
		{
			isDataDirty = true;
			mutedMusic = (value ? 1 : 0);
		}
	}
}

public bool tutorial
{
	get
	{
		return tutorialComplete == 1;
	}
	set
	{
		bool flag = tutorialComplete == 1;
		if (value != flag)
		{
			isDataDirty = true;
			tutorialComplete = (value ? 1 : 0);
		}
	}
}

public int score
{
	get
	{
		return highScore;
	}
	set
	{
		if (value > highScore)
		{
			isDataDirty = true;
			highScore = value;
		}
	}
}

public int ageGate
{
	get
	{
		return ageGateComplete;
	}
	set
	{
		ageGateComplete = value;
		PlayerPrefs.SetInt("agegate", ageGateComplete);
	}
}

private void Start()
{
	bool flag = musicOBJ.isMusicPlaying();
	playerS = GameObject.Find("player").GetComponent<playerScript>();
	isDataDirty = false;
	loadingPreferences();
	vol = base.gameObject.GetComponent<VolumeMutingManager>();
	if (flag)
	{
		vol.muteMusic();
		vol.muteSound();
	}
	else
	{
		if (music)
		{
			vol.muteMusic();
		}
		if (sound)
		{
			vol.muteSound();
		}
	}
	playerS.setTut(tutorial);
	playerS.distanceRecord = score;
	playerS.setupRecordMarker();
}

private void loadingPreferences()
{
	mutedMusic = PlayerPrefs.GetInt("musicMuted");
	if (mutedMusic != 1)
	{
		mutedMusic = 0;
	}
	mutedSound = PlayerPrefs.GetInt("soundMuted");
	if (mutedSound != 1)
	{
		mutedSound = 0;
	}
	tutorialComplete = PlayerPrefs.GetInt("tutorialComplete");
	if (tutorialComplete != 1)
	{
		tutorialComplete = 0;
	}
	highScore = PlayerPrefs.GetInt("highScore");
	if (highScore < 1)
	{
		highScore = 0;
	}
	ageGateComplete = PlayerPrefs.GetInt("agegate");
	if (ageGateComplete < 1)
	{
		ageGateComplete = 0;
	}
	Debug.Log("[SavedPreferencesManager] loaded music: " + mutedMusic + " sound: " + mutedSound + " score: " + highScore + " tutorial " + tutorialComplete + " agegate " + ageGateComplete);
}

public void savingPreferences()
{
	if (isDataDirty)
	{
		PlayerPrefs.SetInt("musicMuted", mutedMusic);
		PlayerPrefs.SetInt("soundMuted", mutedSound);
		PlayerPrefs.SetInt("highScore", highScore);
		PlayerPrefs.SetInt("tutorialComplete", tutorialComplete);
		Debug.Log("[SavedPreferencesManager] saving music: " + mutedMusic + " sound: " + mutedSound + " score: " + highScore + " tutorial " + tutorialComplete);
		isDataDirty = false;
	}
}

public void clearAllSavedData()
{
	PlayerPrefs.SetInt("musicMuted", 0);
	mutedMusic = 0;
	PlayerPrefs.SetInt("soundMuted", 0);
	mutedSound = 0;
	PlayerPrefs.SetInt("highScore", 0);
	highScore = 0;
	PlayerPrefs.SetInt("tutorialComplete", 0);
	tutorialComplete = 0;
	PlayerPrefs.SetInt("agegate", 0);
	ageGateComplete = 0;
	playerScript component = GameObject.Find("player").GetComponent<playerScript>();
	component.onClearData(tutorial, score);
	Application.LoadLevel(0);
}
}

¿Que puedo hacer? Alguien sabe como puedo solucionarlo? Si necesitas mas informacíon, no dudeis en pedirla.

You are trying to access an object called “musicOBJ” that has never been declared in your script. You dont have any variable, field or property with that name in your script and Unity is therefore telling you that it does not exist.


Now I don’t know what type “musicOBJ” is supposed to be but you will need a reference to it if you want to access it in your script. So either create a SerializeField of the type your “musicOBJ” is supposed to be

[SerializeField] private #MusicObjType# musicOBJ;

and reference the object containing that script in your scene from the inspector or do something like

bool flag = FindObjectOfType<#MusicObjectType#>().isMusicPlaying();

since you only seem to access that “musicOBJ” once.


And some general advice: Try to ask your questions in English, there are a lot more people who could potentially help you if they can actually understand some of the information you provide with your question.