Skip to content

Commit 7554f8e

Browse files
committed
fix(lod-generator-helper): mark scene as dirty
When generating or destroying lods in the editor, the scene that the object is in will now be marked as dirty. This fixes issues where Unity doesn't properly detect the changes made, for example when editing prefabs.
1 parent 7a28614 commit 7554f8e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Editor/LODGeneratorHelperEditor.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2828
using System.Linq;
2929
using UnityEngine;
3030
using UnityEditor;
31+
using UnityEditor.SceneManagement;
3132

3233
namespace UnityMeshSimplifier.Editor
3334
{
@@ -522,6 +523,7 @@ private void GenerateLODs()
522523
}
523524
finally
524525
{
526+
MarkSceneAsDirty();
525527
EditorUtility.ClearProgressBar();
526528
}
527529
}
@@ -548,6 +550,7 @@ private void DestroyLODs()
548550
}
549551
finally
550552
{
553+
MarkSceneAsDirty();
551554
EditorUtility.ClearProgressBar();
552555
}
553556
}
@@ -671,6 +674,11 @@ where go.transform.IsChildOf(ourTransform)
671674
return rendererList.ToArray();
672675
}
673676

677+
private void MarkSceneAsDirty()
678+
{
679+
EditorSceneManager.MarkSceneDirty(lodGeneratorHelper.gameObject.scene);
680+
}
681+
674682
private static void DisplayError(string title, string message, string ok, Object context)
675683
{
676684
EditorUtility.DisplayDialog(title, message, ok);

0 commit comments

Comments
 (0)