Replace the asset path attribute with a stable GUID identity
CultInspectorAssetPathAttribute stored an engine asset path, which breaks when the asset moves. CultInspectorAssetGuidAttribute stores the asset's stable identity (in Unity, the .meta GUID) instead. The Studio drawer now resolves the stored GUID to a path only to load the preview object, and writes back AssetPathToGUID on a change. No path form survives for the next field to pick up. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
244154e2f5
commit
95a3c32250
5 changed files with 34 additions and 14 deletions
|
|
@ -41,7 +41,7 @@ namespace GameCult.Caching
|
|||
Order = Find<CultInspectorOrderAttribute>()?.Order;
|
||||
Range = Find<CultInspectorRangeAttribute>();
|
||||
TextArea = Find<CultInspectorTextAreaAttribute>();
|
||||
AssetPath = Find<CultInspectorAssetPathAttribute>();
|
||||
AssetGuid = Find<CultInspectorAssetGuidAttribute>();
|
||||
}
|
||||
|
||||
public IReadOnlyList<Attribute> Attributes { get; }
|
||||
|
|
@ -53,7 +53,7 @@ namespace GameCult.Caching
|
|||
public int? Order { get; }
|
||||
public CultInspectorRangeAttribute? Range { get; }
|
||||
public CultInspectorTextAreaAttribute? TextArea { get; }
|
||||
public CultInspectorAssetPathAttribute? AssetPath { get; }
|
||||
public CultInspectorAssetGuidAttribute? AssetGuid { get; }
|
||||
|
||||
public T? Find<T>() where T : Attribute => Attributes.OfType<T>().FirstOrDefault();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue