지금 몬스터가 죽으면서 아이템 드랍하는거 구현하는 중인데 작동은 잘하는데 테스트 끝나고 자꾸 남아요 ㅠㅠ 뭐가 문제인가요?


에러: Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)


스크립트

--------------------------------------------------------

using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class DroprateManager : MonoBehaviour

{

    [System.Serializable]


    public class Drops

    {

        public string name;

        public GameObject itemPrefab;

        public float dropRate;

    }


    public List<Drops> drops;


    void OnDisable()

    {

        float randomNumber = UnityEngine.Random.Range(0, 100f);

        List<Drops> possibleDrops = new List<Drops>();


        foreach (Drops rate in drops)

        {

            if(randomNumber <= rate.dropRate)

            {

                possibleDrops.Add(rate);

            }

        }

        if(possibleDrops.Count > 0)

        {

            Drops drops = possibleDrops[UnityEngine.Random.Range(0, possibleDrops.Count)];

            Instantiate(drops.itemPrefab, transform.position, Quaternion.identity);

        }

    }

}

--------------------------------------------------------------------------------------------+