-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
In BaseLib.Patches.PostModInitPatch.ProcessModdedTypes, the code uses modType.GetDeclaredProperties() to check for the [SavedProperty] attribute.
However, GetDeclaredProperties() only returns properties defined in the immediate class, ignoring inherited properties. If a modder defines a base class (e.g., AbstractCustomRelic) with [SavedProperty] and multiple relics inherit from it, those derived relic types will fail the check and won't be injected into SavedPropertiesTypeCache.
This causes all inherited saved properties to be lost upon saving/loading.
Suggested Fix:
Change GetDeclaredProperties() to GetProperties() or ensure inherited properties are scanned:
// Current
foreach (PropertyInfo declaredProperty in modType.GetDeclaredProperties())
// Suggested?
foreach (PropertyInfo prop in modType.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))Or, specifically check if the type or its parents contain the attribute.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels