Files
AR-Menu/Library/PackageCache/com.needle.engine-exporter@8c046140a1d9/Common/Runtime/Utils/AssemblyReloadLockScope.cs
2025-11-30 08:35:03 +02:00

26 lines
489 B
C#

using System;
using UnityEditor;
using UnityEngine;
namespace Needle.Engine.Utils
{
/// <summary>
/// Scope assembly lock with nesting support: Unlocks reload if most outer scope is disposed.
/// </summary>
public class AssemblyReloadLockScope : IDisposable
{
public AssemblyReloadLockScope()
{
#if UNITY_EDITOR
EditorApplication.LockReloadAssemblies();
#endif
}
public void Dispose()
{
#if UNITY_EDITOR
EditorApplication.UnlockReloadAssemblies();
#endif
}
}
}