jacobdufault / fullinspector

Full Inspector supercharges Unity's inspector
MIT License
111 stars 27 forks source link

Lost SharedInstance Data #171

Closed 71M closed 7 years ago

71M commented 7 years ago

Hi,

I've followed the SharedInstance example and setup the data successfully in Unity.

My problem arises when I close and relaunch the editor, the instance data is gone and references to the shared stats asset as well.

Assets.zip

Cheers, Tim

71M commented 7 years ago

It appears this error could be related...

ToString is not allowed to be called during serialization, call it from Awake or Start instead. Called from MonoBehaviour 'Zombie' on game object 'MyZombie'. See "Script Serialization" page in the Unity Manual for further details. System.String:Concat(Object[]) FullInspector.InspectedProperty:Write(Object, Object) (at Assets/FullInspector2/Core/Utility/InspectedProperty.cs:129) FullInspector.Internal.fiISerializedObjectUtility:RestoreState(ISerializedObject) (at Assets/FullInspector2/Core/fiISerializedObjectUtility.cs:251) FullInspector.BaseBehavior1:RestoreState() (at Assets/FullInspector2/Core/BaseBehavior.cs:66) FullInspector.Internal.fiSerializationManager:DoDeserialize(ISerializedObject) (at Assets/FullInspector2/Core/fiSerializationManager.cs:212) FullInspector.Internal.fiSerializationManager:OnUnityObjectDeserialize(ISerializedObject) (at Assets/FullInspector2/Core/fiSerializationManager.cs:119) FullInspector.BaseBehavior1:UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize() (at Assets/FullInspector2/Core/BaseBehavior.cs:133) UnityEditor.DockArea:OnGUI()

71M commented 7 years ago

Turns out it isn't picking up the generated shared instance class because the filename doesn't match the class name. I've updated fiSharedInstanceScriptGenerator so className and fileName are the same before calling Emit and it now picks up the class correctly.

Is this something others have come across before?