UI 자동화를 위해 바인딩 기능 구현

- 유니티 에셋 인증 오류로 meta 재생성
This commit is contained in:
2026-01-25 01:31:34 +09:00
parent 2ceb28f55d
commit ce83f21c93
1861 changed files with 377882 additions and 211 deletions

View File

@@ -0,0 +1,57 @@
using System;
using UnityEditor;
namespace UnityEngine.InputSystem
{
// Utility allowing access to object T as well as a dispose delegate to clean-up any resources associated with it.
// Useful with the 'using' keyword to provide scoped RAII-like cleanup of objects in tests without having a
// dedicated fixture handling the clean-up.
internal sealed class ScopedDisposable<T> : IDisposable
where T : UnityEngine.Object
{
private Action<T> m_Dispose;
public ScopedDisposable(T obj, Action<T> dispose)
{
value = obj;
m_Dispose = dispose;
}
public T value
{
get;
private set;
}
public void Dispose()
{
if (m_Dispose == null)
return;
if (value != null)
m_Dispose(value);
m_Dispose = null;
value = null;
}
}
// Convenience API for scoped objects.
internal static class Scoped
{
public static ScopedDisposable<T> Object<T>(T obj) where T : UnityEngine.Object
{
#if UNITY_EDITOR
return new ScopedDisposable<T>(obj, UnityEngine.Object.DestroyImmediate);
#else
return new ScopedDisposable<T>(obj, UnityEngine.Object.Destroy);
#endif
}
#if UNITY_EDITOR
public static ScopedDisposable<T> Asset<T>(T obj) where T : UnityEngine.Object
{
return new ScopedDisposable<T>(obj, (o) => AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(o)));
}
#endif
}
}