News Forums Troubleshooting Corruption Errors of AIRig

This topic contains 4 replies, has 2 voices, and was last updated by  CodersExpo 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #27011

    glennpow
    Participant

    I’m not encountering errors with my AIRig, that crop up when the game is Run and then irreversibly corrupt my AIRig properties. It will reset everything in the rig back to the default settings (removing all Senses, animations, etc.). The errors I see in the console are first a few of these:

    ArgumentException: Object type UnityEngine.Transform cannot be converted to target type: UnityEngine.CharacterController
    Parameter name: val
    System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MonoField.cs:133)
    System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/FieldInfo.cs:150)
    RAIN.Serialization.FieldSerializer.DeserializeClassFromElement (RAIN.Serialization.ObjectElement aParent, System.Object aObject)
    RAIN.Serialization.FieldSerializer.DeserializeReferenceFromElement (Int32 aRefIndex, System.Type aType, System.Object aValue, System.Object& aResult)
    RAIN.Serialization.FieldSerializer.DeserializeTypeFromElement (RAIN.Serialization.ObjectElement aElement, System.Type aType, System.Object aValue, System.Object& aResult)
    RAIN.Serialization.FieldSerializer.DeserializeFieldFromElement (RAIN.Serialization.ObjectElement aParent, System.String aFieldName, System.Type aFieldType, System.Object aFieldValue, System.Object& aFieldResult)
    RAIN.Serialization.FieldSerializer.DeserializeClassFromElement (RAIN.Serialization.ObjectElement aParent, System.Object aObject)
    RAIN.Serialization.FieldSerializer.DeserializeReferenceFromElement (Int32 aRefIndex, System.Type aType, System.Object aValue, System.Object& aResult)
    RAIN.Serialization.FieldSerializer.DeserializeTypeFromElement (RAIN.Serialization.ObjectElement aElement, System.Type aType, System.Object aValue, System.Object& aResult)
    RAIN.Serialization.FieldSerializer.DeserializeFieldFromElement (RAIN.Serialization.ObjectElement aParent, System.String aFieldName, System.Type aFieldType, System.Object aFieldValue, System.Object& aFieldResult)
    RAIN.Serialization.FieldSerializer.DeserializeClassFromElement (RAIN.Serialization.ObjectElement aParent, System.Object aObject)
    RAIN.Serialization.FieldSerializer.DeserializeRAINObject (System.Object aComponent)
    RAIN.Core.RAINComponent.UpdateSerialization ()
    RAIN.Core.RAINComponent.Awake ()
    RAIN.Core.AIRig.Awake ()

    Followed by a bunch of these:

    Argument is out of range.
    Parameter name: index
      at System.Collections.Generic.List`1[System.Object].CheckIndex (Int32 index) [0x00013] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:419 
      at System.Collections.Generic.List`1[System.Object].set_Item (Int32 index, System.Object value) [0x00000] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:637 
      at RAIN.Serialization.FieldSerializer.RemoveReference (Int32 aRefIndex) [0x00000] in <filename unknown>:0 
      at RAIN.Serialization.FieldSerializer.RemoveFieldElement (RAIN.Serialization.ObjectElement aParent, RAIN.Serialization.ObjectElement aChild) [0x00000] in <filename unknown>:0 
      at RAIN.Serialization.FieldSerializer.SetArrayCount (RAIN.Serialization.ObjectElement aElement, IList aList, Int32 aCount, IList& aResult) [0x00000] in <filename unknown>:0 
      at RAIN.Serialization.FieldWalker.SetArrayCount (Int32 aCount) [0x00000] in <filename unknown>:0 
      at RAIN.Serialization.FieldWalker.ValidateElements () [0x00000] in <filename unknown>:0 
      at RAIN.Serialization.FieldWalker.FirstChild () [0x00000] in <filename unknown>:0 
      at RAIN.Serialization.FieldWalkerList.FirstChild () [0x00000] in <filename unknown>:0 
      at RAINEditor.Perception.RAINBasicSensesEditor.DrawInspector (System.String aLabel, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0 
      at RAINEditor.TypeEditors.RAINTypeEditor.DrawFieldForInspector (RAINEditor.Core.RAINComponentEditor aEditor, System.String aLabel, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0 
      at RAINEditor.TypeEditors.RAINTypeEditor.DrawFieldForInspector (RAINEditor.Core.RAINComponentEditor aEditor, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0 
      at RAINEditor.TypeEditors.RAINTypeEditor.DrawFieldForInspector (RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0 
      at RAINEditor.Core.AIEditor.DrawInspector (System.String aLabel, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0 
      at RAINEditor.TypeEditors.RAINTypeEditor.DrawFieldForInspector (RAINEditor.Core.RAINComponentEditor aEditor, System.String aLabel, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0 
      at RAINEditor.TypeEditors.RAINTypeEditor.DrawFieldForInspector (RAINEditor.Core.RAINComponentEditor aEditor, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0 
      at RAINEditor.Core.AIRigEditor.DrawComponentForInspector (RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0 
      at RAINEditor.Core.RAINComponentEditor.OnInspectorGUI () [0x00000] in <filename unknown>:0 
    UnityEngine.Debug:LogError(Object)
    RAINEditor.Core.RAINComponentEditor:OnInspectorGUI()
    UnityEditor.DockArea:OnGUI()

    Sometimes I can revert the prefab, and it will work until I make further modifications, but I now have some prefabs that will trigger these errors immediately upon being reverted (and so I have essentially lost all the data in those AIRigs).
    I will attempt to dig into the serialization data inside the prefab to see if I can see anything, but this is a major problem if my AI’s will be so vulnerable to corruption and loss of hours of work.
    Any help you can give would be appreciated. Thanks

    #27015

    glennpow
    Participant

    Well, my problem stemmed from the fact that my CharacterController had been accidentally deleted from my character’s root GameObject. It was user error for sure, but it would probably be good if the RAIN deserialization logic would be a little more robust for these edge-cases, so that it doesn’t throw away the entirety of the AIRig data.

    #27016

    CodersExpo
    Participant

    So what exactly are the steps you’re doing before this occurs. I assume you have a model that you set AI up and then make it a prefab and it then fails. Is that correct?

    #27018

    glennpow
    Participant

    Those are the steps, but also along the way the CharacterController was removed from the root GO, but the AIRig was still referencing that CC (or at least the transform of that root GO). The deserializer probably just needs to do some sanity checks with that CC reference, to make sure the component really exists and is a CC. And if not, then it will revert to BasicMotor, but continue deserializing without major error/corruption of the remaining data.

    #27024

    CodersExpo
    Participant

    I agree a more graceful recovery and message would be nice. I think the problem is when the AIRig is being de-serialized the error is thrown up the stack rather than continuing. Thus all your settings are there but just can’t be de-serialized because of the error not allowing the process to continue.

    Question is can the process continue without that component being de-serialized properly. The AIRig initialization process may have a number of other steps that depend on the expected component type. Another good question for the Rival Theory team.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.