Open diccon01 opened 8 years ago
Can you also post the BaseBehavior type that this error occurred on?
Thanks for getting back so quickly, I selected the FullSerializer from the manager on both machines.
Sorry, I'm a bit confused now. Can you post to code you used for the type that caused the error? For example, the code that is integrating with Full Inspector.
Sure, I'm not sure whether to post all the files, or just parts, there are many dependencies... The only class that directly depends on FullInspector looks like this:
using FullInspector;
public class GoalStateMachine : BaseBehavior
{
public System.Collections.Generic.Dictionary<string, IGoalState> states = new System.Collections.Generic.Dictionary<string, IGoalState>();
IGoalState currentState;
...
}
The interface looks like this:
public interface IGoalState
{
string UpdateState(AIController controller);
int ID();
void OnEnter(AIController controller);
void OnExit(AIController controller);
string Name();
}
Then there are several different classes that implement the interface like this:
using System;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class IdleState : IGoalState
{
[SerializeField]
public string name;
public string Name()
{
return name;
}
int id;
public int ID()
{
return id;
}
public void OnEnter(AIController controller)
{
}
public void OnExit(AIController controller)
{
}
public string UpdateState(AIController controller)
{
return name;
}
}
The saved file that caused the deserialization error contained one instance of GoalStateMachine, which contained 10 different states in its dictionary. The file loads and saves perfectly on the machine where it was created, but when I submit to perforce and load it on a different machine the exception occurs.
Let me know if you need any more information, but I would rather not post full source code to the forum.
Oh the serialized data looks like this for the GoalStateMachine component:
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1857189524}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3c4749348da85f545b3324c14dbe73e8, type: 3}
m_Name:
m_EditorClassIdentifier:
_objectReferences:
- {fileID: 1819410774}
- {fileID: 732861438}
- {fileID: 130618141}
_serializedStateKeys:
- states
_serializedStateValues:
- '{"TakeOff":{"name":"TakeOff","NextStateName":"Climb","takeOffSpeed":15.0,"takeOffPitch":-45.0,"$type":"TakeOffState"}
...
Are both machines on the same version of Unity?
If so, can you send me an email? I'll send you the current FI build so we can make sure it's not a trial-specific issue.
Hi Jacob, yes both machines were running the same version, which was 4.6.9. I've actually shelved that feature for a while and started working on something else, although it turns out I want FullInspector for this new thing too, so I will do another source control test and let you know if I get a similar error.
Diccon
On 30 March 2016 at 23:11, Jacob Dufault notifications@github.com wrote:
Are both machines on the same version of Unity?
If so, can you send me an email? I'll send you the current FI build so we can make sure it's not a trial-specific issue.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/jacobdufault/fullinspector/issues/136#issuecomment-203771026
I am trying out the FullInspector 4.6 demo in order to use polymorphic containers in editor, and it worked very nicely allowing me to create an AI state machine of classes derived from an interface.
However when I shared the file with my colleague using perforce he got a deserialization error, even though he had also installed the same demo package.
As I work with a team it is crucial that we are able to share scenes, so I would like to know if this problem can be resolved before we make the decision to purchase full licenses. I will paste the error below, and can provide other source code if it will help.
Thanks. Diccon
Exception caught when deserializing property in <AIPlane (GoalStateMachine)>
System.Exception: Cannot create an instance of an interface or abstract type for IGoalState
at FullSerializer.fsMetaType.CreateInstance () [0x00000] in :0
at FullSerializer.Internal.fsReflectedConverter.CreateInstance (FullSerializer.fsData data, System.Type storageType) [0x00000] in :0
at FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List:0
at FullSerializer.fsSerializer.InternalDeserialize_1CycleReference (FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x00000] in :0
at FullSerializer.fsSerializer.TryDeserialize (FullSerializer.fsData data, System.Type storageType, System.Object& result) [0x00000] in :0
at FullSerializer.Internal.fsDictionaryConverter.TryDeserialize (FullSerializer.fsData data, System.Object& instance , System.Type storageType) [0x00000] in :0
at FullSerializer.fsSerializer.InternalDeserialize_5_Converter (FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00000] in :0
at FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00000] in :0
at FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List:0
at FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List
1& processors) [0x00000] in <filename unknown>:0 at FullSerializer.fsSerializer.InternalDeserialize_2_Version (FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List
1& processors) [0x00000] in1& processors) [0x00000] in <filename unknown>:0 at FullSerializer.fsSerializer.InternalDeserialize_2_Version (FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List
1& processors) [0x00000] in1& processors) [0x00000] in <filename unknown>:0 at FullSerializer.fsSerializer.TryDeserialize (FullSerializer.fsData data, System.Type storageType, System.Object& result) [0x00000] in <filename unknown>:0 at FullInspector.FullSerializerSerializer.Deserialize (System.Reflection.MemberInfo storageType, System.String serializedState, ISerializationOperator serializationOperator) [0x00000] in <filename unknown>:0 at FullInspector.Internal.fiISerializedObjectUtility.RestoreState[FullSerializerSerializer](ISerializedObject obj) [0x00000] in <filename unknown>:0 UnityEngine.Debug:LogError(Object, Object) FullInspector.Internal.fiISerializedObjectUtility:RestoreState(ISerializedObject) FullInspector.BaseBehavior
1:RestoreState() FullInspector.BaseBehavior`1:OnValidate()