Switch engine asset references from Resources paths to Addressables GUIDs
Cut 2 of docs/addressables-cut.md. The asset move (git mv
Resources/{Prefabs,Schematics,Sprites/Icons} -> Content/...) and the
UnityHelpers.cs deletion already landed in 1fdf8151, picked up by a
concurrent session sharing this working tree; this commit is the rest
of Cut 2 landing on top of that shared state, atomically:
- Bump CultLib to cultlib-unity-v1.0.60 / caching-unity-v1.4.0 (both
45c2f40) in Packages/manifest.json, packages-lock.json and
Directory.Build.props, together with the 8 ServerShared
[CultInspectorAssetPath] usages becoming [CultInspectorAssetGuid] -
the .NET and Unity sides move together or nothing compiles.
- Assets/Scripts/EngineAssets.cs replaces UnityHelpers: loads an
Addressables key (bare GUID or guid[subAsset]) synchronously,
loading the GameObject and taking the component for the four sites
that load a component. ActionBarSlot, EntityInstance, ShipInstance
and ZoneRenderer call it instead of Resources.Load/UnityHelpers; the
inline "Assets/Resources/" prefix strips are gone with them.
CultCacheDrawers' schematic preview goes through
AssetDatabase.GUIDToAssetPath first.
- Assets/Scripts/Editor/EngineAssetCheck.cs validates every stored
[CultInspectorAssetGuid] value: 32 lowercase hex, resolves to a file,
is addressable, and satisfies its member's consumer-type contract
(Texture2D for icons/logos/schematics, a GameObject with the right
component for prefabs) - table-driven, so an attributed member with
no row fails loudly instead of being skipped.
- GameData/Aetheria.cc: the scratch migration (Aetheria.Shared + the
pinned CultLib revision, a throwaway console app, never landed)
walked all 138 attributed field slots across 180 documents,
rewriting the 30 non-empty Resources paths to their .meta GUIDs -
108 stayed empty, 0 unresolved, matching the map's census exactly.
Verification: dotnet test tests/Aetheria.Shared.Tests 61/61 green
against CultLib 45c2f40; Unity 6000.3.24f1 batchmode compiles clean;
EngineAssetCheck.Run passes all 30 stored references; the map's
negative greps are clean; tests/mutation_tests.py's 5 mutations (wrong
type, non-addressable, random guid, an old path, and an untabled
attributed member) are all caught and named, the control case and the
post-revert recompile stay clean, and the catalog/source are restored
byte-identical afterward.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
1fdf815111
commit
67cbf34b25
20 changed files with 544 additions and 555 deletions
|
|
@ -101,7 +101,7 @@ public sealed class InspectableSchematicShapeDrawer : ICultInspectorDrawer
|
|||
var shape = value as Shape ?? new Shape();
|
||||
var item = inspector.Record as EquippableItemData;
|
||||
var hull = item as HullData;
|
||||
var schematic = string.IsNullOrEmpty(item?.Schematic) ? null : AssetDatabase.LoadAssetAtPath<Texture2D>(item.Schematic);
|
||||
var schematic = string.IsNullOrEmpty(item?.Schematic) ? null : AssetDatabase.LoadAssetAtPath<Texture2D>(AssetDatabase.GUIDToAssetPath(item.Schematic));
|
||||
|
||||
EditorGUILayout.LabelField(label);
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
|
|
|
|||
206
Assets/Scripts/Editor/EngineAssetCheck.cs
Normal file
206
Assets/Scripts/Editor/EngineAssetCheck.cs
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using GameCult.Caching;
|
||||
using MessagePack;
|
||||
using UnityEditor;
|
||||
using UnityEditor.AddressableAssets;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
// docs/addressables-cut.md §2.5: validates every [CultInspectorAssetGuid] string member stored in
|
||||
// the catalog. Read-only: it opens the catalog through AetheriaStores.Open exactly like the game
|
||||
// does, and never writes. No repair path — a failure names the record, member, GUID and path.
|
||||
public static class EngineAssetCheck
|
||||
{
|
||||
// One row per attributed member (docs/addressables-cut.md §2.5 point 4). A member found on a
|
||||
// stored document but missing here fails the check, so a new field can't skip validation.
|
||||
private delegate bool Contract(object owner, Type ownerType, Object asset, out string reason);
|
||||
|
||||
private static readonly Dictionary<string, Contract> ConsumerContracts = new Dictionary<string, Contract>
|
||||
{
|
||||
["Icon"] = (object owner, Type ownerType, Object asset, out string reason) => TypeContract<Texture2D>(asset, out reason),
|
||||
["ActionBarIcon"] = (object owner, Type ownerType, Object asset, out string reason) => TypeContract<Texture2D>(asset, out reason),
|
||||
["Schematic"] = (object owner, Type ownerType, Object asset, out string reason) => TypeContract<Texture2D>(asset, out reason),
|
||||
["Logo"] = (object owner, Type ownerType, Object asset, out string reason) => TypeContract<Texture2D>(asset, out reason),
|
||||
["Prefab"] = (object owner, Type ownerType, Object asset, out string reason) => ComponentContract<EntityInstance>(asset as GameObject, out reason),
|
||||
["ParticlesPrefab"] = (object owner, Type ownerType, Object asset, out string reason) => ComponentContract<ParticleSystem>(asset as GameObject, out reason),
|
||||
["Particles"] = (object owner, Type ownerType, Object asset, out string reason) => ComponentContract<ParticleSystem>(asset as GameObject, out reason),
|
||||
["EffectPrefab"] = EffectPrefabContract,
|
||||
};
|
||||
|
||||
// Menu entry for interactive use; -executeMethod EngineAssetCheck.Run for batchmode/CI, exit 1 on failure.
|
||||
[MenuItem("Aetheria/Validate Engine Asset References")]
|
||||
public static void Run()
|
||||
{
|
||||
var failures = RunCheck(out var checkedCount);
|
||||
foreach (var failure in failures) Debug.LogError(failure);
|
||||
Debug.Log(failures.Count == 0
|
||||
? $"EngineAssetCheck: {checkedCount} stored reference(s) OK."
|
||||
: $"EngineAssetCheck: {failures.Count} failure(s) of {checkedCount} checked.");
|
||||
|
||||
if (Application.isBatchMode)
|
||||
EditorApplication.Exit(failures.Count == 0 ? 0 : 1);
|
||||
}
|
||||
|
||||
// Returns one failure line per bad stored reference; empty when everything resolves. Exposed for the
|
||||
// mutation tests (tests/mutation_tests.py) driving this same method through a batchmode -executeMethod.
|
||||
public static List<string> RunCheck(out int checkedCount)
|
||||
{
|
||||
var failures = new List<string>();
|
||||
checkedCount = 0;
|
||||
|
||||
var root = Directory.GetParent(Application.dataPath)!.FullName;
|
||||
var catalogPath = Path.Combine(root, "GameData", "Aetheria.cc");
|
||||
var cache = AetheriaStores.Open(catalogPath);
|
||||
try
|
||||
{
|
||||
foreach (var stored in cache.AllStoredDocuments.ToArray())
|
||||
{
|
||||
var docType = stored.Descriptor.DocumentType;
|
||||
var document = stored.Document;
|
||||
var name = NameOf(document, docType);
|
||||
var seen = new HashSet<object>();
|
||||
|
||||
foreach (var (owner, field) in WalkAssetGuidFields(document, seen))
|
||||
{
|
||||
var key = (string)field.GetValue(owner);
|
||||
if (string.IsNullOrEmpty(key)) continue;
|
||||
checkedCount++;
|
||||
|
||||
var label = $"{docType.Name} \"{name}\" .{field.Name} = \"{key}\"";
|
||||
|
||||
if (!CultAssetGuidKey.TryParse(key, out var guid, out var subAssetName))
|
||||
{
|
||||
failures.Add($"{label}: not a valid Addressables key (guid or guid[subAsset])");
|
||||
continue;
|
||||
}
|
||||
if (guid.Length != 32 || !guid.All(IsLowerHex))
|
||||
{
|
||||
failures.Add($"{label}: GUID \"{guid}\" is not 32 lowercase hex characters");
|
||||
continue;
|
||||
}
|
||||
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
if (string.IsNullOrEmpty(path) || !File.Exists(Path.Combine(root, path)))
|
||||
{
|
||||
failures.Add($"{label}: GUID {guid} names no existing file");
|
||||
continue;
|
||||
}
|
||||
|
||||
var entry = AddressableAssetSettingsDefaultObject.Settings?.FindAssetEntry(guid, true);
|
||||
if (entry == null)
|
||||
{
|
||||
failures.Add($"{label}: {path} ({guid}) is not addressable");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ConsumerContracts.TryGetValue(field.Name, out var contract))
|
||||
{
|
||||
failures.Add($"{label}: no consumer contract registered for member \"{field.Name}\"; add one to EngineAssetCheck.ConsumerContracts");
|
||||
continue;
|
||||
}
|
||||
|
||||
Object asset = string.IsNullOrEmpty(subAssetName)
|
||||
? AssetDatabase.LoadAssetAtPath<Object>(path)
|
||||
: AssetDatabase.LoadAllAssetsAtPath(path).FirstOrDefault(a => a.name == subAssetName);
|
||||
if (asset == null)
|
||||
{
|
||||
failures.Add($"{label}: {(string.IsNullOrEmpty(subAssetName) ? path : path + "[" + subAssetName + "]")} did not load");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!contract(owner, owner.GetType(), asset, out var reason))
|
||||
failures.Add($"{label}: {reason}");
|
||||
}
|
||||
}
|
||||
|
||||
return failures;
|
||||
}
|
||||
finally
|
||||
{
|
||||
cache.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private static bool TypeContract<T>(Object asset, out string reason) where T : Object
|
||||
{
|
||||
if (!(asset is T)) { reason = $"asset is a {asset.GetType().Name}, not a {typeof(T).Name}"; return false; }
|
||||
reason = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool ComponentContract<T>(GameObject gameObject, out string reason) where T : Component
|
||||
{
|
||||
if (gameObject == null) { reason = "asset is not a GameObject"; return false; }
|
||||
if (gameObject.GetComponent<T>() == null) { reason = $"GameObject has no {typeof(T).Name}"; return false; }
|
||||
reason = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool EffectPrefabContract(object owner, Type ownerType, Object asset, out string reason)
|
||||
{
|
||||
var gameObject = asset as GameObject;
|
||||
if (typeof(InstantWeaponData).IsAssignableFrom(ownerType)) return ComponentContract<InstantWeaponEffectManager>(gameObject, out reason);
|
||||
if (typeof(ConstantWeaponData).IsAssignableFrom(ownerType)) return ComponentContract<ConstantWeaponEffectManager>(gameObject, out reason);
|
||||
reason = $"unrecognised WeaponData subtype {ownerType.Name} for EffectPrefab";
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsLowerHex(char c) => (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
|
||||
|
||||
private static string NameOf(object document, Type docType)
|
||||
{
|
||||
var nameField = docType.GetField("Name", BindingFlags.Public | BindingFlags.Instance);
|
||||
return nameField?.GetValue(document) as string ?? "(unnamed)";
|
||||
}
|
||||
|
||||
// Same shape as AetherDb's DanglingRefs / the migration's WalkAssetPathFields: plain fields, list
|
||||
// elements, and nested [MessagePackObject]/[Union] values (a HullData's Behaviors list, say).
|
||||
private static IEnumerable<(object Owner, FieldInfo Field)> WalkAssetGuidFields(object value, HashSet<object> seen)
|
||||
{
|
||||
if (value == null || !seen.Add(value)) yield break;
|
||||
foreach (var field in value.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
|
||||
{
|
||||
if (field.FieldType == typeof(string))
|
||||
{
|
||||
if (field.GetCustomAttribute<CultInspectorAssetGuidAttribute>() != null)
|
||||
yield return (value, field);
|
||||
continue;
|
||||
}
|
||||
|
||||
var member = field.GetValue(value);
|
||||
if (member == null) continue;
|
||||
|
||||
if (member is IDictionary dictionary)
|
||||
{
|
||||
foreach (var key in dictionary.Keys)
|
||||
{
|
||||
foreach (var nested in WalkAssetGuidFields(key, seen)) yield return nested;
|
||||
foreach (var nested in WalkAssetGuidFields(dictionary[key], seen)) yield return nested;
|
||||
}
|
||||
}
|
||||
else if (member is IList list && !(member is Array { Rank: > 1 }))
|
||||
{
|
||||
foreach (var element in list)
|
||||
if (element != null && IsSerializedObject(element.GetType()))
|
||||
foreach (var nested in WalkAssetGuidFields(element, seen)) yield return nested;
|
||||
}
|
||||
else if (IsSerializedObject(member.GetType()))
|
||||
{
|
||||
foreach (var nested in WalkAssetGuidFields(member, seen)) yield return nested;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsSerializedObject(Type type)
|
||||
{
|
||||
for (var t = type; t != null && t != typeof(object); t = t.BaseType)
|
||||
if (t.IsDefined(typeof(MessagePackObjectAttribute), false) || t.IsDefined(typeof(UnionAttribute), false))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Editor/EngineAssetCheck.cs.meta
Normal file
2
Assets/Scripts/Editor/EngineAssetCheck.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 66eb9b3ae90c36b4e920ed38d0dc0036
|
||||
50
Assets/Scripts/EngineAssets.cs
Normal file
50
Assets/Scripts/EngineAssets.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GameCult.Caching;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
// Turns a CultCache-stored Addressables key (bare GUID, or "guid[subAssetName]" for a sub-asset;
|
||||
// see CultAssetGuidKey and docs/addressables-cut.md Ruling S) into a loaded asset. Replaces
|
||||
// UnityHelpers.LoadAsset, which stripped an "Assets/Resources/" path prefix; there is no path to
|
||||
// strip any more; the catalog names the asset by its stable .meta GUID and Addressables resolves
|
||||
// it, in editor play mode and in a built player alike. Owns one Addressables handle per (key,
|
||||
// type) for the process lifetime; nothing here releases a handle, which is the lifetime
|
||||
// Resources.Load had. All call sites are synchronous construction paths that Instantiate at once,
|
||||
// so loading stays synchronous (WaitForCompletion) rather than reordering entity construction.
|
||||
public static class EngineAssets
|
||||
{
|
||||
private static readonly Dictionary<(string Key, Type Type), Object> Cache = new Dictionary<(string, Type), Object>();
|
||||
|
||||
public static T Load<T>(string key) where T : Object
|
||||
{
|
||||
if (string.IsNullOrEmpty(key)) return null;
|
||||
|
||||
var cacheKey = (key, typeof(T));
|
||||
if (Cache.TryGetValue(cacheKey, out var cached)) return cached as T;
|
||||
|
||||
T asset;
|
||||
if (typeof(Component).IsAssignableFrom(typeof(T)))
|
||||
{
|
||||
// Addressables cannot load a component directly: load the GameObject and take it from there.
|
||||
var handle = Addressables.LoadAssetAsync<GameObject>(key);
|
||||
var gameObject = handle.WaitForCompletion();
|
||||
asset = gameObject == null ? null : gameObject.GetComponent<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
var handle = Addressables.LoadAssetAsync<T>(key);
|
||||
asset = handle.WaitForCompletion();
|
||||
}
|
||||
|
||||
if (asset == null)
|
||||
{
|
||||
Debug.LogError($"EngineAssets: failed to load {typeof(T).Name} for Addressables key \"{key}\"");
|
||||
return null;
|
||||
}
|
||||
|
||||
Cache[cacheKey] = asset;
|
||||
return asset;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/EngineAssets.cs.meta
Normal file
2
Assets/Scripts/EngineAssets.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3f3cca818d26268459d28af1cdb469a5
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using TMPro;
|
||||
|
|
@ -111,7 +110,7 @@ public class ActionBarConsumableBinding : ActionBarBinding
|
|||
{
|
||||
Slot.Label.gameObject.SetActive(false);
|
||||
Slot.Icon.gameObject.SetActive(true);
|
||||
Slot.Icon.texture = Resources.Load<Texture2D>(data.Icon.Substring("Assets/Resources/".Length).Split('.').First());
|
||||
Slot.Icon.texture = EngineAssets.Load<Texture2D>(data.Icon);
|
||||
}
|
||||
else Slot.Icon.gameObject.SetActive(false);
|
||||
}
|
||||
|
|
@ -150,7 +149,7 @@ public class ActionBarGearBinding : ActionBarBinding
|
|||
Slot.Icon.gameObject.SetActive(true);
|
||||
Slot.Label.gameObject.SetActive(false);
|
||||
if (!string.IsNullOrEmpty(Item.Data.ActionBarIcon))
|
||||
Slot.Icon.texture = Resources.Load<Texture2D>(Item.Data.ActionBarIcon.Substring("Assets/Resources/".Length).Split('.').First());
|
||||
Slot.Icon.texture = EngineAssets.Load<Texture2D>(Item.Data.ActionBarIcon);
|
||||
else if (data is WeaponItemData weaponItemData)
|
||||
Slot.Icon.texture = ActionGameManager.Instance.Settings.GetIcon(weaponItemData.WeaponType).texture;
|
||||
else Slot.Icon.texture = ActionGameManager.Instance.Settings.GetIcon(data.HardpointType).texture;
|
||||
|
|
|
|||
|
|
@ -192,12 +192,12 @@ public class EntityInstance : MonoBehaviour
|
|||
var data = (InstantWeaponData) instantWeapon.Data;
|
||||
if (!_instantWeaponManagers.ContainsKey(data))
|
||||
{
|
||||
var managerPrefab = UnityHelpers.LoadAsset<InstantWeaponEffectManager>(data.EffectPrefab);
|
||||
var managerPrefab = EngineAssets.Load<InstantWeaponEffectManager>(data.EffectPrefab);
|
||||
if(managerPrefab)
|
||||
{
|
||||
_instantWeaponManagers.Add(data, Instantiate(managerPrefab, EffectManagerParent));
|
||||
}
|
||||
else Debug.LogError($"No InstantWeaponEffectManager prefab found at path {data.EffectPrefab}");
|
||||
else Debug.LogError($"No InstantWeaponEffectManager prefab found for GUID {data.EffectPrefab}");
|
||||
}
|
||||
|
||||
instantWeapon.OnFire += () =>
|
||||
|
|
@ -221,12 +221,12 @@ public class EntityInstance : MonoBehaviour
|
|||
var data = (ConstantWeaponData) constantWeapon.Data;
|
||||
if (!_constantWeaponManagers.ContainsKey(data))
|
||||
{
|
||||
var managerPrefab = UnityHelpers.LoadAsset<ConstantWeaponEffectManager>(data.EffectPrefab);
|
||||
var managerPrefab = EngineAssets.Load<ConstantWeaponEffectManager>(data.EffectPrefab);
|
||||
if(managerPrefab)
|
||||
{
|
||||
_constantWeaponManagers.Add(data, Instantiate(managerPrefab, EffectManagerParent));
|
||||
}
|
||||
else Debug.LogError($"No ConstantWeaponEffectManager prefab found at path {data.EffectPrefab}");
|
||||
else Debug.LogError($"No ConstantWeaponEffectManager prefab found for GUID {data.EffectPrefab}");
|
||||
}
|
||||
|
||||
constantWeapon.OnStartFiring += () =>
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class ShipInstance : EntityInstance
|
|||
var drive = ship.GetBehavior<AetherDrive>();
|
||||
if (drive != null)
|
||||
{
|
||||
var particles = Instantiate(UnityHelpers.LoadAsset<ParticleSystem>(drive.DriveData.Particles), transform, false);
|
||||
var particles = Instantiate(EngineAssets.Load<ParticleSystem>(drive.DriveData.Particles), transform, false);
|
||||
var main = particles.main;
|
||||
main.customSimulationSpace = LocalSpace;
|
||||
_aetherDrive = new AetherDriveInstance
|
||||
|
|
@ -64,7 +64,7 @@ public class ShipInstance : EntityInstance
|
|||
_thrusters = ship.GetBehaviors<Thruster>().Select(thruster =>
|
||||
{
|
||||
var effectData = (ThrusterData) thruster.Data;
|
||||
var particles = Instantiate(UnityHelpers.LoadAsset<ParticleSystem>(effectData.ParticlesPrefab), transform, false);
|
||||
var particles = Instantiate(EngineAssets.Load<ParticleSystem>(effectData.ParticlesPrefab), transform, false);
|
||||
var particlesShape = particles.shape;
|
||||
var thrusterHardpoint = ThrusterHardpoints
|
||||
.FirstOrDefault(t => t.name == ship.Hardpoints[thruster.Item.Position.x, thruster.Item.Position.y].Transform);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class AetherDriveData : BehaviorData
|
|||
[Inspectable, JsonProperty("torqueAudio"), Key(12), RuntimeInspectable]
|
||||
public uint TorqueRatioAudioParameter;
|
||||
|
||||
[Inspectable, CultInspectorAssetPath, JsonProperty("particles"), Key(13)]
|
||||
[Inspectable, CultInspectorAssetGuid, JsonProperty("particles"), Key(13)]
|
||||
public string Particles;
|
||||
|
||||
public override Behavior CreateInstance(EquippedItem item)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class ThrusterData : BehaviorData
|
|||
[Inspectable, JsonProperty("energy"), Key(4), RuntimeInspectable]
|
||||
public PerformanceStat EnergyUsage = new PerformanceStat();
|
||||
|
||||
[Inspectable, CultInspectorAssetPath, JsonProperty("Particles"), Key(5)]
|
||||
[Inspectable, CultInspectorAssetGuid, JsonProperty("Particles"), Key(5)]
|
||||
public string ParticlesPrefab;
|
||||
|
||||
public override Behavior CreateInstance(EquippedItem item)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public abstract class WeaponData : BehaviorData
|
|||
[InspectableAnimationCurve, JsonProperty("damageCurve"), Key(7)]
|
||||
public BezierCurve DamageCurve;
|
||||
|
||||
[Inspectable, CultInspectorAssetPath, JsonProperty("effect"), Key(8)]
|
||||
[Inspectable, CultInspectorAssetGuid, JsonProperty("effect"), Key(8)]
|
||||
public string EffectPrefab;
|
||||
|
||||
[Inspectable, JsonProperty("energy"), Key(9), RuntimeInspectable]
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class Faction
|
|||
[Inspectable, CultInspectorTextArea, JsonProperty("description"), Key(3)]
|
||||
public string Description;
|
||||
|
||||
[Inspectable, CultInspectorAssetPath, JsonProperty("logo"), Key(4)]
|
||||
[Inspectable, CultInspectorAssetGuid, JsonProperty("logo"), Key(4)]
|
||||
public string Logo;
|
||||
|
||||
[Inspectable, CultReference(typeof(PersonalityAttribute), many: true), JsonProperty("personality"), Key(5)]
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ public class ConsumableItemData : CraftedItemData
|
|||
[Inspectable, JsonProperty("duration"), Key(12)]
|
||||
public float Duration;
|
||||
|
||||
[Inspectable, CultInspectorAssetPath, JsonProperty("icon"), Key(13)]
|
||||
[Inspectable, CultInspectorAssetGuid, JsonProperty("icon"), Key(13)]
|
||||
public string Icon;
|
||||
|
||||
[Inspectable, JsonProperty("effectiveness"), Key(14)]
|
||||
|
|
@ -359,7 +359,7 @@ public class ConsumableItemData : CraftedItemData
|
|||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public abstract class EquippableItemData : CraftedItemData
|
||||
{
|
||||
[Inspectable, CultInspectorAssetPath, JsonProperty("schematic"), Key(10)]
|
||||
[Inspectable, CultInspectorAssetGuid, JsonProperty("schematic"), Key(10)]
|
||||
public string Schematic;
|
||||
|
||||
[Inspectable, JsonProperty("behaviors"), Key(11)]
|
||||
|
|
@ -389,7 +389,7 @@ public abstract class EquippableItemData : CraftedItemData
|
|||
// [Inspectable, JsonProperty("sfx"), Key(19)]
|
||||
// public string SoundEffectTrigger;
|
||||
|
||||
[Inspectable, CultInspectorAssetPath, JsonProperty("actionIcon"), Key(20)]
|
||||
[Inspectable, CultInspectorAssetGuid, JsonProperty("actionIcon"), Key(20)]
|
||||
public string ActionBarIcon;
|
||||
|
||||
[Inspectable, JsonProperty("soundBank"), Key(21)]
|
||||
|
|
@ -496,7 +496,7 @@ public class HullData : EquippableItemData
|
|||
[Inspectable, JsonProperty("hardpoints"), Key(23)]
|
||||
public List<HardpointData> Hardpoints = new List<HardpointData>();
|
||||
|
||||
[Inspectable, CultInspectorAssetPath, JsonProperty("prefab"), Key(24)]
|
||||
[Inspectable, CultInspectorAssetGuid, JsonProperty("prefab"), Key(24)]
|
||||
public string Prefab;
|
||||
|
||||
[Inspectable, JsonProperty("hullType"), Key(25)]
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ public class ZoneRenderer : MonoBehaviour
|
|||
EntityInstance instance;
|
||||
if (entity is Ship)
|
||||
{
|
||||
instance = Instantiate(UnityHelpers.LoadAsset<GameObject>(hullData.Prefab), ZoneRoot).GetComponent<ShipInstance>();
|
||||
instance = Instantiate(EngineAssets.Load<GameObject>(hullData.Prefab), ZoneRoot).GetComponent<ShipInstance>();
|
||||
if (instance == null)
|
||||
{
|
||||
ItemManager.Log($"Failed to instantiate {hullData.Name} ship with invalid prefab: no ShipInstance component!");
|
||||
|
|
@ -301,7 +301,7 @@ public class ZoneRenderer : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
instance = Instantiate(UnityHelpers.LoadAsset<GameObject>(hullData.Prefab), ZoneRoot).GetComponent<EntityInstance>();
|
||||
instance = Instantiate(EngineAssets.Load<GameObject>(hullData.Prefab), ZoneRoot).GetComponent<EntityInstance>();
|
||||
if (instance == null)
|
||||
{
|
||||
ItemManager.Log($"Failed to instantiate {hullData.Name} entity with invalid prefab: no EntityInstance component!");
|
||||
|
|
|
|||
Loading…
Reference in a new issue