Type 'Enemy' dooes not contain a definition for 'scoreDrop' Line (68,33) in GameMaster

Hello,
I am trying to set it up to where an enemy dies you get score, (all the script is below) and I seem to have gotten the error aforementioned, please help me in solving this error, no clue why it happened as I thought I had referenced scoreDrop correctly but I guess I had not.
Thanks!

GameMaster:

using UnityEngine;
using System.Collections;
using UnityStandardAssets.ImageEffects;

public class GameMaster : MonoBehaviour {

	public static GameMaster gm;

	[SerializeField]
	private int startingScore;
	public static int Score;

	void Awake () {
		if (gm == null) {
			gm = GameObject.FindGameObjectWithTag ("GM").GetComponent<GameMaster>();
		}
	}

	public Transform playerPrefab;
	public Transform spawnPoint;
	public float spawnDelay = 2;
	public Transform spawnPrefab;

	[SerializeField]
	private GameObject upgradeMenu;


	public delegate void UpgradeMenuCallback (bool active);
	public UpgradeMenuCallback onToggleUpgradeMenu;

	void Start()
	{
		Score = startingScore;
	}

	void Update ()
	{
		if (Input.GetKeyDown (KeyCode.U)) 
		{
			ToggleUpgradeMenu ();
		}
	}

	private void ToggleUpgradeMenu () 
	{
		upgradeMenu.SetActive ( !upgradeMenu.activeSelf );
		onToggleUpgradeMenu.Invoke (upgradeMenu);
	}

	public IEnumerator RespawnPlayer () {
		yield return new WaitForSeconds (spawnDelay);

		Instantiate (playerPrefab, spawnPoint.position, spawnPoint.rotation);
		GameObject clone = Instantiate (spawnPrefab, spawnPoint.position, spawnPoint.rotation) as GameObject;
		Destroy (clone, 3f);
	}

	public static void KillPlayer (Player player) {
		Destroy (player.gameObject);
		gm.StartCoroutine (gm.RespawnPlayer());
	}
	
	public static void KillEnemy (Enemy enemy) {
		gm._KillEnemy(enemy);
		}
	public void _KillEnemy(Enemy _enemy)
	{
		Score += _enemy.scoreDrop;
		Destroy (_enemy.gameObject);
	}

}

Enemy:

using UnityEngine;
using System.Collections;

public class Enemy : MonoBehaviour {

	[System.Serializable]
	public class EnemyStats {
		public int maxHealth = 100;

		public int scoreDrop = 10;

		private int _curHealth;
		public int curHealth
		{
			get { return _curHealth; }
			set { _curHealth = Mathf.Clamp (value, 0, maxHealth); }
		}

		public void Init()
		{
			curHealth = maxHealth;
		}
	}
	
	public EnemyStats stats = new EnemyStats();

	[Header("Optional: ")]
	[SerializeField]
	private StatusIndicator statusIndicator;

	void Start()
	{
		stats.Init ();

		if (statusIndicator != null)
		{
			statusIndicator.SetHealth (stats.curHealth, stats.maxHealth);
		}
	}
	
	public void DamageEnemy (int damage) {
		stats.curHealth -= damage;
		if (stats.curHealth <= 0)
		{
			GameMaster.KillEnemy (this);
		}

		if (statusIndicator != null)
		{
			statusIndicator.SetHealth (stats.curHealth, stats.maxHealth);
		}
	}
}

Hi @MythicEclipsed

Looking at your Enemy class. It appears that you have a nested class called “EnemyStats”. This means, that when you access your Enemy class reference inside of your “KillEnemy” method. You are accessing a member that doesn’t exist.

To fix this, you will want to access the reference to your nested “EnemyStats” class and then access the “scoreDrop” variable. For instance:

public void _KillEnemy(Enemy _enemy)
     {
         Score += _enemy.stats.scoreDrop;
         Destroy (_enemy.gameObject);
     }

Something like that, should work. I hope this helps.