Dreampriest
New member
I have an editor script that I use to automatically create my ammo items, but all the created items give me an error about missing attributes every time I recompile:
The autofix doesn't seem to actually fix the error as it will keep displaying the message every time.
Here is the code I'm using to generate the items:
ItemDefinition AMMO_Freeze Gun is missing an ItemDefinition Attribute named 'Icon'.
UnityEngine.Debug:LogWarning (object)
Opsive.UltimateInventorySystem.Editor.Managers.DatabaseValidator:Validate (Opsive.UltimateInventorySystem.Core.ItemCategory,bool) (at Assets/Standard Assets/Opsive/UltimateInventorySystem/Editor/Managers/DatabaseValidator.cs:431)
Opsive.UltimateInventorySystem.Editor.Managers.DatabaseValidator:CheckIfValid (Opsive.UltimateInventorySystem.Storage.InventorySystemDatabase,bool) (at Assets/Standard Assets/Opsive/UltimateInventorySystem/Editor/Managers/DatabaseValidator.cs:104)
Opsive.UltimateInventorySystem.Editor.Managers.InventoryMainWindow:ValidateDatabase () (at Assets/Standard Assets/Opsive/UltimateInventorySystem/Editor/Managers/InventoryMainWindow.cs:315)
Opsive.UltimateInventorySystem.Editor.Managers.InventoryMainWindow:OnEnable () (at Assets/Standard Assets/Opsive/UltimateInventorySystem/Editor/Managers/InventoryMainWindow.cs:214)
The database is not valid. An autofix process will now run.
UnityEngine.Debug:LogWarning (object)
Opsive.UltimateInventorySystem.Editor.Managers.InventoryMainWindow:ValidateDatabase () (at Assets/Standard Assets/Opsive/UltimateInventorySystem/Editor/Managers/InventoryMainWindow.cs:317)
Opsive.UltimateInventorySystem.Editor.Managers.InventoryMainWindow:OnEnable () (at Assets/Standard Assets/Opsive/UltimateInventorySystem/Editor/Managers/InventoryMainWindow.cs:214)
The autofix doesn't seem to actually fix the error as it will keep displaying the message every time.
Here is the code I'm using to generate the items:
C#:
var ammoitem = ItemDefinitionEditorUtility.AddItemDefinition("AMMO_" + itemDefinition.name, ammoCategory, database, DatabaseValidator.GetDatabaseDirectory(database));
var newAmmoData = new AmmoData(ammoitem, ammoData.ClipSize, ammoData.ClipRemaining, ammoData.ReserveAmmoCount);
ammoDataAttr.SetOverrideValue(newAmmoData);
AttributeEditorUtility.SetVariantType(ammoDataAttr, VariantType.Override);
ItemDefinitionEditorUtility.SetItemDefinitionDirty(itemDefinition, true);