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:
Meta Vens 2026-09-17 18:43:03 +02:00
commit 95a3c32250
5 changed files with 34 additions and 14 deletions

View file

@ -42,6 +42,15 @@ namespace GameCult.Caching.Tests
Assert.That(hidden.ValueType, Is.EqualTo(typeof(string)));
}
[Test]
public void AssetGuidMemberExposesItsAttributeAndDeclaredType()
{
var member = Model().MembersOf(typeof(InspectAsset)).Single();
Assert.That(member.Metadata.AssetGuid, Is.Not.Null);
Assert.That(member.Metadata.AssetGuid!.AssetType, Is.EqualTo(typeof(Uri)));
}
[Test]
public void ClaimsResolveAttributeThenTypeThenBuiltIn()
{
@ -321,6 +330,14 @@ namespace GameCult.Caching.Tests
public string Name = string.Empty;
}
[CultDocument("tests.inspect_asset", "tests.inspect_asset.v1")]
[MessagePackObject]
public sealed class InspectAsset
{
[Key(0)] [CultInspectorAssetGuid(typeof(Uri))]
public string Guid = string.Empty;
}
[CultDocument("tests.inspect_fixed", "tests.inspect_fixed.v1")]
[MessagePackObject]
public sealed class InspectFixed