Failed to resolve prefab modification path warning

Issue #7 resolved
Ivan Wang
created an issue

I'm seeing the following warning logged to console:

Failed to resolve prefab modification path 'events.[0].background' at step '[0]'.
UnityEngine.Debug:LogWarning(Object)
Sirenix.Serialization.PrefabModification:SetInstanceToPath(String, String[], Int32, Object, Object, Boolean&) (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Utilities/PrefabModification.cs:370)
Sirenix.Serialization.PrefabModification:SetInstanceToPath(String, String[], Int32, Object, Object, Boolean&) (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Utilities/PrefabModification.cs:374)
Sirenix.Serialization.PrefabModification:SetInstanceToPath(String, Object, Object) (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Utilities/PrefabModification.cs:357)
Sirenix.Serialization.PrefabModification:ApplyValue(Object) (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Utilities/PrefabModification.cs:90)
Sirenix.Serialization.PrefabModification:Apply(Object) (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Utilities/PrefabModification.cs:53)
Sirenix.Serialization.UnitySerializationUtility:ApplyPrefabModifications(Object, List`1, List`1) (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Utilities/UnitySerializationUtility.cs:1278)
Sirenix.Serialization.UnitySerializationUtility:DeserializeUnityObjectInEditor(Object, SerializationData&, DeserializationContext, Boolean) (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Utilities/UnitySerializationUtility.cs:800)
Sirenix.Serialization.UnitySerializationUtility:DeserializeUnityObject(Object, SerializationData&, DeserializationContext) (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Utilities/UnitySerializationUtility.cs:693)
Sirenix.OdinInspector.SerializedMonoBehaviour:UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize() (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Unity Integration/SerializedMonoBehaviour.cs:25)
UnityEditor.PrefabUtility:SetPropertyModifications(Object, PropertyModification[])
Sirenix.Serialization.UnitySerializationUtility:SetUnityObjectModifications(Object, SerializationData&, Object) (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Utilities/UnitySerializationUtility.cs:532)
Sirenix.Serialization.UnitySerializationUtility:SerializeUnityObject(Object, SerializationData&, SerializationContext) (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Utilities/UnitySerializationUtility.cs:302)
Sirenix.OdinInspector.SerializedMonoBehaviour:UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize() (at C:/Users/Bjarke/Desktop/Projects/sirenix-development-framework/Sirenix Solution/Sirenix.Serialization/Unity Integration/SerializedMonoBehaviour.cs:31)

Steps to Repro

  1. Define the following classes:
public abstract class BaseEvent {}
public class MessageEvent : BaseEvent {
    public int background;
}
public class EventManager : SerializedMonoBehaviour {
    [OdinSerialize]
    private List<BaseEvent> events;
}
  1. Create an empty GameObject with an EventManager with an empty list of events.
  2. Save the GameObject as a prefab.
  3. Add a MessageEvent to the events property of the GameObject (not the prefab).
  4. Delete the MessageEvent from the GameObject.
  5. Observe logged warning.

Using Unity v5.5.0f3.

Comments (3)

  1. Tor Esa Vestergaard

    Thank you for the report! We've reproduced this issue, and introduced a fix, which will be included in the next patch. The issue was that prefab modifications for elements with invalid indices were not removed when the length of a list was changed.

  2. Log in to comment