以下の内容はhttps://baba-s.hatenablog.com/entry/2023/04/21/110708より取得しました。


【Unity】Performance warning: There are more than 100 preview scenes.

概要

Performance warning: There are more than 100 preview scenes. 
There might be code not releasing the preview scene after creating it.
UnityEditor.InspectorWindow:RedrawFromNative ()

PrefabUtility.LoadPrefabContents でプレハブを大量に読み込んで編集したところ
Project ビューでプレハブを選択した時などに上記の警告が出るようになり、
Unity エディタの動作が重くなった

foreach ( var assetPath in assetPaths )
{
    var prefabRoot = PrefabUtility.LoadPrefabContents( assetPath );

    if ( ... ) continue; // ★

    PrefabUtility.SaveAsPrefabAsset( prefabRoot, assetPath );
    PrefabUtility.UnloadPrefabContents( prefabRoot );
}

おそらくプレハブ編集後に PrefabUtility.UnloadPrefabContents
呼び出さないことがあるのが原因だった

Unity を再起動したら警告が出なくなった

プレハブ編集時に PrefabUtility.EditPrefabContentsScope を使うことで
同様の問題が再発しないように対策した

関連記事




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

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