This commit is contained in:
2026-11-24 15:51:02 +01:00
parent cca4d73e41
commit f4aa17114a
22092 changed files with 5042406 additions and 0 deletions
@@ -0,0 +1,44 @@
#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEditor;
namespace UnityEngine.InputSystem.Utilities
{
internal static class DirtyAssetTracker
{
/// <summary>
/// Keep track of InputActionAsset assets that you want to re-load. This is useful because some user actions,
/// such as adding a new input binding at runtime, change the in-memory representation of the input action asset and
/// those changes survive when exiting Play mode. If you re-open an Input Action Asset in the Editor that has been changed
/// this way, you see the new bindings that have been added during Play mode which you might not typically want to happen.
///
/// You can avoid this by force re-loading from disk any asset that has been marked as dirty.
/// </summary>
/// <param name="asset"></param>
public static void TrackDirtyInputActionAsset(InputActionAsset asset)
{
if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(asset, out string assetGuid, out long _) == false)
return;
s_TrackedDirtyAssets.Add(assetGuid);
}
public static void ReloadDirtyAssets()
{
foreach (var assetGuid in s_TrackedDirtyAssets)
{
var assetPath = AssetDatabase.GUIDToAssetPath(assetGuid);
if (string.IsNullOrEmpty(assetPath))
continue;
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate);
}
s_TrackedDirtyAssets.Clear();
}
private static HashSet<string> s_TrackedDirtyAssets = new HashSet<string>();
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fa1cedc2b36c5fc49a203b0e02a22d64
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: