Mine Launcher: a shape and a product that sells it; the blast-neutrality test exempts a mine layer; WireMines takes a Substance material by its path
The first catalog commit left the item shapeless and unsold; this commit's mine-launcher command fixes both. The catalog blob committed before this one is superseded by the next commit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b60c695a61
commit
8b2147a5f7
4 changed files with 30 additions and 3 deletions
|
|
@ -77,9 +77,13 @@ public static class WireMines
|
|||
{
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
if (string.IsNullOrEmpty(path)) throw new System.InvalidOperationException($"No asset for guid {guid}");
|
||||
foreach (var asset in AssetDatabase.LoadAllAssetsAtPath(path).OfType<T>())
|
||||
// A Substance archive's material is regenerated on import under another local id, so a path holding
|
||||
// exactly one T is that T whatever its id.
|
||||
var assets = AssetDatabase.LoadAllAssetsAtPath(path).OfType<T>().ToArray();
|
||||
foreach (var asset in assets)
|
||||
if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(asset, out _, out long id) && id == fileId)
|
||||
return asset;
|
||||
if (assets.Length == 1) return assets[0];
|
||||
throw new System.InvalidOperationException($"No {typeof(T).Name} with file id {fileId} in {path}");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue