以下の内容はhttps://baba-s.hatenablog.com/entry/2022/08/30/214227より取得しました。


【Unity】Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)

概要

using UnityEngine;

public class Example : MonoBehaviour
{
    private void OnDestroy()
    {
        new GameObject();
    }
}
using UnityEngine;

public class Example : MonoBehaviour
{
    public GameObject m_prefab;

    private void OnDestroy()
    {
        Instantiate( m_prefab );
    }
}

上記のように OnDestroy で new GameObject()Instantiate( m_prefab )
ゲームオブジェクトを生成していると

Some objects were not cleaned up when closing the scene. 
(Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
XXXX

上記のエラーが発生します




以上の内容はhttps://baba-s.hatenablog.com/entry/2022/08/30/214227より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14