Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Full Inspector: Inspector and serialization for structs, dicts, generics, interfaces

Discussion in 'Assets and Asset Store' started by sient, Jan 23, 2014.

  1. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Quick question, since your product is on sale. Would there be value to me, a non-programmer, in purchasing your asset, and what would it give me that I do not already have with basic Unity Inspector? Remember, I am very novice programmer, and cannot follow most of your discussion above.
     
  2. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
  3. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I use intensively ScriptableObjects with FullInspector and I can't think of a better way to deal with them.
     
  4. olonge

    olonge

    Joined:
    Sep 22, 2014
    Posts:
    16
    Hi Sient

    I'm interested in getting this, but would like to test it out on 5.3 first. Sale ends in 2.5hrs :-(
     
  5. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    With all the posts about problems it seems that this asset will break every time Unity does an update.
     
  6. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Not exactly true. Since 5.0 - 5.3 it worked fine except BaseNetworkBehavior bug in 5.3 (fixed now). 5.4 changed a lot of Unity API this asset use, but all were fixed now. I am using it with 5.4b11, and it works perfectly fine.
     
  7. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Damn. Was just going to buy it but just missed the sale. Now I can't buy it and feel good about it due to my indecisiveness. Guess I'll have to wait till next time.
     
  8. IronNinja

    IronNinja

    Joined:
    Jan 7, 2015
    Posts:
    4
    I'm a bit frustrated -- I too was going to buy it just now. It's right now 6:34 AM PST and the 24 hour sales always reset at 7AM my time. I'm wondering if they made a mistake and started the new sale earlier -- taking the Inspector asset off BEFORE the 24 hours were up...?
     
  9. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    It's about from one week that Unity changed the switching time.
     
  10. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Doesn't work ... Unity 5.3.4f1. What's wrong ?

    Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
    at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
    at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
    at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
    at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
    at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
    at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
    at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0

    The following assembly referenced from /Users/cem/Unity/Pichu/Assets/FullInspector2/Serializers/JsonNet/DLLs/Newtonsoft.Json.dll could not be loaded:
    Assembly: System.Xml.Linq (assemblyref_index=4)
    Version: 3.5.0.0
    Public Key: b77a5c561934e089
    The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/Users/cem/Unity/Pichu/Assets/FullInspector2/Serializers/JsonNet/DLLs/).

    Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
    The class Newtonsoft.Json.Converters.XObjectWrapper could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null
    The class Newtonsoft.Json.Converters.XObjectWrapper could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null
    The class Newtonsoft.Json.Converters.XContainerWrapper could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null
    The class Newtonsoft.Json.Converters.XObjectWrapper could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null
    The class Newtonsoft.Json.Converters.XObjectWrapper could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null
    The class Newtonsoft.Json.Converters.XObjectWrapper could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null
    The class Newtonsoft.Json.Converters.XObjectWrapper could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null
    The class Newtonsoft.Json.Converters.XContainerWrapper could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=null
     
  11. gaweph

    gaweph

    Joined:
    Sep 2, 2012
    Posts:
    26
    I missed this sale, frustrating!!
     
  12. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Bug when building for Windows Store (Universal 10):

    I get the following exception when deserializing an array of my custom type (has only one item):

    Code (CSharp):
    1. System.TypeInitializationException: The type initializer for 'FullSerializer.Internal.fsTypeCache' threw an exception. ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    2. Parameter name: index
    3.    at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
    4.    at System.Collections.Generic.List`1.set_Item(Int32 index, T value)
    5.    at FullSerializer.Internal.fsTypeCache..cctor()
    6.    --- End of inner exception stack trace ---
    7.    at FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    8.    at FullSerializer.fsSerializer.InternalDeserialize_2_Version(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    9.    at FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    10.    at FullSerializer.fsSerializer.TryDeserialize(fsData data, Type storageType, Type overrideConverterType, Object& result)
    11.    at FullSerializer.Internal.fsReflectedConverter.TryDeserialize(fsData data, Object& instance, Type storageType)
    12.    at FullSerializer.fsSerializer.InternalDeserialize_5_Converter(Type overrideConverterType, fsData data, Type resultType, Object& result)
    13.    at FullSerializer.fsSerializer.InternalDeserialize_4_Cycles(Type overrideConverterType, fsData data, Type resultType, Object& result)
    14.    at FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    15.    at FullSerializer.fsSerializer.InternalDeserialize_2_Version(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    16.    at FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    17.    at FullSerializer.fsSerializer.TryDeserialize(fsData data, Type storageType, Type overrideConverterType, Object& result)
    18.    at FullSerializer.Internal.fsReflectedConverter.TryDeserialize(fsData data, Object& instance, Type storageType)
    19.    at FullSerializer.fsSerializer.InternalDeserialize_5_Converter(Type overrideConverterType, fsData data, Type resultType, Object& result)
    20.    at FullSerializer.fsSerializer.InternalDeserialize_4_Cycles(Type overrideConverterType, fsData data, Type resultType, Object& result)
    21.    at FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    22.    at FullSerializer.fsSerializer.InternalDeserialize_2_Version(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    23.    at FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    24.    at FullSerializer.fsSerializer.TryDeserialize(fsData data, Type storageType, Type overrideConverterType, Object& result)
    25.    at FullSerializer.Internal.fsArrayConverter.TryDeserialize(fsData data, Object& instance, Type storageType)
    26.    at FullSerializer.fsSerializer.InternalDeserialize_5_Converter(Type overrideConverterType, fsData data, Type resultType, Object& result)
    27.    at FullSerializer.fsSerializer.InternalDeserialize_4_Cycles(Type overrideConverterType, fsData data, Type resultType, Object& result)
    28.    at FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    29.    at FullSerializer.fsSerializer.InternalDeserialize_2_Version(Type overrideConverterType, fsData data, Type storageType, Object& result, List`1& processors)
    30.    at FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference(Type overrideConverterType, fsData data, Type st

    Any clue?

    Thanks! :)
     
  13. Longhorn01

    Longhorn01

    Joined:
    Apr 4, 2016
    Posts:
    1
    It would be great if Full Inspector had support for copying/pasting of classes and other fields in the inspector. So, for example, if I configure an instance of a class in one component, I would right click, select Copy, and then a copy of that instance can be pasted in another field of appropriate type. Sort of what Unity has with Paste Component Values, but on a more granular level. This would vastly simplify configuring deep, nested objects. Are there any plans to implement this feature?

    Also, is there a way to hide a member of a subclass, if that member is declared public in the parent class? Redeclaring the subclass member with "private new" should be the proper way to do it, but it still ends up being visible in the inspector.

    Thank you for a great asset!
     
    johanneskopf likes this.
  14. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    In general, the inspector will work a better - better collection support, for example. You also don't need to worry as much about what will serialize and what won't, since pretty much everything will serialize.

    It's gone through a couple of changes in the backend to
    • take advantage of the new Unity serialization callback APIs (FI came out over two years ago!, so those APIs were not available back then)
    • small changes to the serialization architecture implementation to support Unity 5.4
    The serialization code and the rest of the FI codebase are actually very stable at this point.

    Do you have Json.NET for Unity installed? If you don't want to use Json.NET, you can delete the FullInspector2/Serializers/JsonNet folder and just use FullSerializer instead (which is what I recommend).
     
  15. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    I'll take a look at this the next time I'm on my windows machine - should be tonight or tomorrow.
     
    Maisey likes this.
  16. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Not at the moment. I don't have a way to "deep copy" and arbitrary field on an object quite yet. I've filled issue 141 about this.

    You could use InspectorShowIf with a boolean property you override to return false in the child.

    private new is actually introducing an entirely new variable that is completely independent of the original one in the parent class - the semantics of the parent classes' variable do not change. The private new variable shadows the original variable - so this will unfortunately not cause the parent variable to be hidden, since the parent variable is not changed.
     
  17. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Thanks, I've fixed the dictionary rendering issue. It'll be fixed when I upload the next build to access.

    I have a prototype InspectorCollectionSorted implementation, but I don't think it's feasible to implement at the moment. There are a whole of slew of issues with it, primarily caused because the order of the elements is changing as you're editing them. Unity doesn't handle this scenario very well and ends up causing large amounts of data change.

    Preventing this is accidental reordering is possible with the new DelayedTextField API, but this introduces other issues that are also complicated to work around.
     
  18. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Yes I saw that adding element to dictionaries now causes often the keys to be reordered unpredictably. Just an idea... you could use a temporary list of keys in memory so, at least while editing, you force the dictionary to don't have dancing keys.
     
  19. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Thanks! I gutted out a repo-case for you. Has to do with interfaces/generics. See attached file.
     

    Attached Files:

  20. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
     
  21. olonge

    olonge

    Joined:
    Sep 22, 2014
    Posts:
    16
    Hi Sient. I went ahead and purchased anyway.

    Does Full Inspector uniform support multidimensional arrays. I can see it supporting jagged arrays like ...


    Code (CSharp):
    1. [fiInspectorOnly]
    2. public class MyMono : MonoBehaviour {
    3.  
    4.     public bool[][] jaggedArray = new bool[5][];
    5.     public bool[,] uniArray = new bool[5,3];
    6.  
    7.  
    8.     void Start(){
    9.         for (int i = 0; i < jaggedArray.Length; i++) {
    10.             jaggedArray[i] = new bool[3];
    11.         }
    12.     }
    13. }

    the jagged array works but the uniform one produces the error I attached in FI_UniArrayError.txt. I actually need a series of 3 dimensional arrays and would prefer not to have to loop through each one initialising them so as to use Full Inspector.

    Also, what would be the best way to collapse each nested array, if it is at all possible, so that I can focus on only one dataset at a time

    Thanks
     

    Attached Files:

    Last edited: Apr 9, 2016
  22. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Sorry, multi-dimensional arrays not currently supported, but jagged arrays work.

    For collapsing the array entires, if you only have a two-dimensional array you can do it like this:

    Code (csharp):
    1. using FullInspector;
    2.  
    3. public class Example : BaseBehavior {
    4.     [InspectorCollectionShowItemDropdown]
    5.     public int[][] a;
    6. }
    A 3D array is a bit more complex, but it is possible with

    Code (csharp):
    1. using System.Collections.Generic;
    2. using FullInspector;
    3.  
    4. public class Example : BaseBehavior {
    5.     class ObjectsItemAttrs : fiICollectionAttributeProvider {
    6.          public IEnumerable<object> GetAttributes() {
    7.              yield return new InspectorCollectionShowItemDropdownAttribute();
    8.          }
    9.     }
    10.  
    11.     [InspectorCollectionShowItemDropdown]
    12.     [InspectorCollectionItemAttributesAttribute(typeof(ObjectsItemAttrs))]
    13.     public int[][][] a;
    14. }
    The C# attribute system is simply not expressive enough to make this pleasant. Note that as of right now, you cannot express the foldout with a 4D+ array.
     
  23. olonge

    olonge

    Joined:
    Sep 22, 2014
    Posts:
    16
  24. zge

    zge

    Joined:
    Sep 18, 2014
    Posts:
    35
    Hi Sient,

    I've been trying Full Serializer, but I'm still learning C# and I'm missing something that I'm sure is simple.

    Using the example code from github I cannot figure out what to use for "Type".
    Code (CSharp):
    1. class = FullSerialize.Deserialize(Class, (Resources.Load("ClassText") as TextAsset).text);
    gives me error CS0119 'Class' is a type, which is not valid in the given context.

    Code (CSharp):
    1. class = FullSerialize.Deserialize(class.GetType(), (Resources.Load("ClassText") as TextAsset).text);
    gives me error CS0266 Cannot implicitly convert type 'object' to 'Class'

    I can deserialize to the same object using JsonUtility, but Full Serializer has me stumped.
     
  25. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    I've hit a nasty bug with using FI on (Base)ScriptableObjects.

    If you have a List of objects where those objects have a double field, and you set the double to be a round large number (1000000000000000000 for instance) when you hit play FI will delete the List from the ScriptableObject.

    I've not dug into the code but looking at the serialization info I think there's a clue there as these large round numbers show up as "1E+15.0" instead of "1.0E+15"

    Example project (sans FI) attached.
     

    Attached Files:

  26. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    fiInspectorOnly should have absolutely zero performance impact. There is no serialized data stored and Awake/etc are not modified.
     
  27. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    class is a reserved keyword. Try using a different name and seeing what error message you get. Can you also post the code for your FullSerialize.Deserialize method?
     
  28. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Thanks, this is indeed bug in Full Serializer. I'll try to get a fix checked in tonight or tomorrow morning. The next build on Access will include the fix - which I will upload after checking the fix in.
     
  29. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Fixed; I'll upload a new FI build shortly. Thanks! See https://github.com/jacobdufault/fullserializer/commit/8ab01de3058ed52a03e7aa720f12acdfd616c76a.
     
  30. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    Thanks for the speedy response, still seeing the issue with the latest 'fixed' Access build though.

    Additionally ... discovered a few out of date links to http://jacobdufault.github.io/fullinspector/assets/docs/index.html (on the original forum post, at the bottom of http://jacobdufault.github.io/fullinspector/) and the dll-builder zip INSTRUCTIONS could do with an update as you're now supplying prebuilt dlls in a separate unity package while the ones in the zip are out of date (and shouldn't be there?).

    Also ... I think you really need to include some setup/installation instructions. There's no reference anywhere that there are now two Unity packages, and no instructions on what should/shouldn't be imported if you decide to use the source package etc. On top of that the whole 'pick a default serializer' thing is ... way too complicated. I'd suggest you just default to FullSerializer and provide instructions for how to switch to an alternate as an advanced topic in the guide along with reasons for why you'd want to do so.

    Overall the package is super-handy but it's a little rough around the edges!

    Ok I looked through the code, here's a better hack:
    Code (CSharp):
    1. if (doubledString.Contains(".") == false){
    2.     if(doubledString.Contains("E")){
    3.         doubledString = doubledString.Insert(doubledString.IndexOf("E"),".0");
    4.     }else{
    5.         doubledString += ".0";
    6.     }
    7. }
     
    Last edited: Apr 19, 2016
    mcmorry likes this.
  31. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Ah, looks like this was a separate issue in the parser (https://github.com/jacobdufault/fullserializer/commit/c2f64e5f571533d3d9efe6b370ca4cd02c9de6be).

    I've uploaded a new build to Access with the fix. I've fixed the doc links in the first post on the forum thread. I'll work on getting them updated elsewhere.

    Yes, I plan on making pick a default serializer simpler / automatic - likely though a rewrite of that system. I've been focused on trying to enable multi-object editing lately.

    Thanks for the bug reports!
     
    Aurigan likes this.
  32. zge

    zge

    Joined:
    Sep 18, 2014
    Posts:
    35
    Thanks so much for your reply.

    I'm not actually using the word "class", I just used that as an example as I'd tried a number of different classes. Here is the deserialize method from github that I'm using:

    Code (CSharp):
    1. using System;
    2. using FullSerializer;
    3.  
    4. public static class FullSerialize
    5. {
    6.     private static readonly fsSerializer _serializer = new fsSerializer();
    7.  
    8.     public static string Serialize(Type type, object value)
    9.     {
    10.         // serialize the data
    11.         fsData data;
    12.         _serializer.TrySerialize(type, value, out data).AssertSuccessWithoutWarnings();
    13.  
    14.         // emit the data via JSON
    15.         return fsJsonPrinter.CompressedJson(data);
    16.     }
    17.  
    18.     public static object Deserialize(Type type, string serializedState)
    19.     {
    20.         // step 1: parse the JSON data
    21.         fsData data = fsJsonParser.Parse(serializedState);
    22.  
    23.         // step 2: deserialize the data
    24.         object deserialized = null;
    25.         _serializer.TryDeserialize(data, type, ref deserialized).AssertSuccessWithoutWarnings();
    26.  
    27.         return deserialized;
    28.     }
    29. }
    And the code I'm using to call it which results in Type errors:

    Code (CSharp):
    1. map = FullSerialize.Deserialize(Map, mapString);
    And the code that's working with JsonUtility:

    Code (CSharp):
    1. map = JsonUtility.FromJson<Map>(mapString);
     
  33. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    I think that
    Code (csharp):
    1. map = (Map)FullSerialize.Deserialize(typeof(Map), mapString);
    should do the trick.
     
  34. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Any progress on this? @sient
     
    Last edited: Apr 21, 2016
  35. zge

    zge

    Joined:
    Sep 18, 2014
    Posts:
    35
    Many many thanks :)
     
  36. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Yes, it should be fixed in this commit. I have uploaded a new build to access.

    Sorry about the delay - I had a bunch of strange issues with WSA builds not related to Full Inspector.
     
    Maisey likes this.
  37. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    @sient Just a small detail: the last build available in the access page has 2.6.3 in the name, but in the change log I read 2.6.4
     
  38. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Thanks!

    Just tried it but got another issue, which is related to deserializing interfaces or abstract types.

    Code (CSharp):
    1. Exception caught when deserializing property <serializedConstraints> with type <ACE.UI.UIView>
    2. System.Exception: Cannot create an instance of an interface or abstract type for ACE.Serialization.ISerializeableDTO`1[ACE.UI.Layout.IVariable]
    3.    at FullSerializer.fsMetaType.CreateInstance()
    Is there a convenient workaround for this on WSA? It works on both iOS & Android, and would love to have the same implementation for all platforms. :)
     
  39. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    325
    Hello!

    Could be possible to have the lastest trial version? I have Unity 5.3 and I am having some issues that I think they are fixed right now:
    Code (CSharp):
    1. UNetWeaver error: NetworkBehaviour BaseNetworkBehavior`1 cannot have generic parameters
    2. UnityEngine.Debug:LogError(Object)
    Thank you!
     
  40. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    809
    Hi Jacob!

    Minor feature request. Could we have an InspectorHeight attribute for AnimationCurve properties? Their display is tiny and it's useful to be able to see them at a glance. Less importantly, an attribute to set its Color property would be neat, too. Maybe combine them, like so:

    Code (CSharp):
    1. [InspectorCurve(Height = 35f, Color = Color.Cyan)]
    Cheers!
     
  41. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Fixed - thanks :)

    Can you post the serialized JSON? It sounds like ISerialazbleDTO<IVariable> is in the JSON as the stored object type. It's strange it is working on both iOS and Android, though. My guess is something to do with stripping.


    I've sent you a PM.

    Sure - right now the AnimationCurve implementation should be identical to Unity's, though.

    I've added a feature request here. I'll do my best to get to it as soon as I'm able.
     
  42. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Can't get a hold of it right now, but I did make a test which (back when I posted) reproduced the issue (see attached file).

    Thanks!
     

    Attached Files:

  43. noanoa

    noanoa

    Joined:
    Apr 17, 2014
    Posts:
    225
    Hi, old serialized data seem to still remain after deleting/changing a field. (eg. when adding [NotSerialized] attribute to already serialized field, the field still gets deserialized). I've also changed some serialized fields to static fields of the same names and had weird behaviors. Is there a way to only delete serialized data that are no longer used? I am using version2.62 with default FullSerializer.
     
  44. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Small bug I've noticed: I have a BaseBehaviour with a field of type Dictionary<ParticleSystem, float>. When there's actual data in the dictionary it works great, but when the dictionary is empty it throws this error when trying to apply changes from a scene object back to its prefab:

    Code (csharp):
    1.  
    2. Exception caught when deserializing property <particleSystems> with type <WeatherPreset>
    3. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Argument cannot be null.
    4. Parameter name: key
    5.   at System.Collections.Generic.Dictionary`2[UnityEngine.ParticleSystem,System.Int32].Add (UnityEngine.ParticleSystem key, Int32 value) [0x0000b] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:43
    6.   at System.Collections.Generic.Dictionary`2[UnityEngine.ParticleSystem,System.Int32].System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add (KeyValuePair`2 keyValuePair) [0x00009] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:617
    7.   at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
    8.   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222
    9.   --- End of inner exception stack trace ---
    10.   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232
    11.   at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115
    12.   at FullSerializer.Internal.fsDictionaryConverter.AddItemToDictionary (IDictionary dictionary, System.Object key, System.Object value) [0x00068] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\FullSerializer\Module\Assets\FullSerializer\Source\Converters\fsDictionaryConverter.cs:145
    13.   at FullSerializer.Internal.fsDictionaryConverter.TryDeserialize (FullSerializer.fsData data, System.Object& instance_, System.Type storageType) [0x00108] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\FullSerializer\Module\Assets\FullSerializer\Source\Converters\fsDictionaryConverter.cs:40
    14.   at FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x0001d] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\FullSerializer\Module\Assets\FullSerializer\Source\fsSerializer.cs:836
    15.   at FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00035] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\FullSerializer\Module\Assets\FullSerializer\Source\fsSerializer.cs:828
    16.   at FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (System.Type overrideConverterType, FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x0010e] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\FullSerializer\Module\Assets\FullSerializer\Source\fsSerializer.cs:807
    17.   at FullSerializer.fsSerializer.InternalDeserialize_2_Version (System.Type overrideConverterType, FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x00133] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\FullSerializer\Module\Assets\FullSerializer\Source\fsSerializer.cs:747
    18.   at FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (System.Type overrideConverterType, FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x0004c] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\FullSerializer\Module\Assets\FullSerializer\Source\fsSerializer.cs:702
    19.   at FullSerializer.fsSerializer.TryDeserialize (FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x00040] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\FullSerializer\Module\Assets\FullSerializer\Source\fsSerializer.cs:673
    20.   at FullSerializer.fsSerializer.TryDeserialize (FullSerializer.fsData data, System.Type storageType, System.Object& result) [0x00000] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\FullSerializer\Module\Assets\FullSerializer\Source\fsSerializer.cs:648
    21.   at FullInspector.FullSerializerSerializer.Deserialize (System.Reflection.MemberInfo storageType, System.String serializedState, ISerializationOperator serializationOperator) [0x00028] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\FullSerializer\FullSerializerSerializer.cs:98
    22.   at FullInspector.Internal.fiISerializedObjectUtility.RestoreState[FullSerializerSerializer] (ISerializedObject obj) [0x0019c] in F:\Unity\Empires\Assets\Plugins\FullInspector2\Core\fiISerializedObjectUtility.cs:224
    23. UnityEngine.Debug:LogError(Object, Object)
    24. FullInspector.Internal.fiISerializedObjectUtility:RestoreState(ISerializedObject) (at Assets/Plugins/FullInspector2/Core/fiISerializedObjectUtility.cs:229)
    25. FullInspector.BaseBehavior`1:RestoreState() (at Assets/Plugins/FullInspector2/Core/BaseBehavior.cs:65)
    26. FullInspector.Internal.fiSerializationManager:DoDeserialize(ISerializedObject) (at Assets/Plugins/FullInspector2/Core/fiSerializationManager.cs:210)
    27. FullInspector.Internal.fiSerializationManager:OnUnityObjectDeserialize(ISerializedObject) (at Assets/Plugins/FullInspector2/Core/fiSerializationManager.cs:117)
    28. FullInspector.BaseBehavior`1:UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize() (at Assets/Plugins/FullInspector2/Core/BaseBehavior.cs:132)
    29. System.Reflection.MethodBase:Invoke(Object, Object[])
    30. PrefabEvolution.PEOverrideInternalEditor:OnHeaderGUI() (at Assets/Plugins/PrefabEvolution/Sources/Editor/PEOverrideInternalEditor.cs:95)
    31. PrefabEvolution.PEGameObjectInspectorOverride:OnHeaderGUI() (at Assets/Plugins/PrefabEvolution/Sources/Editor/PEGameObjectInspectorOverride.cs:91)
    32. UnityEditor.DockArea:OnGUI()
     
  45. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    You should find different options to delete serialized data in "Windows->FullInspector->Developer" (don't have unity at this computer but something like that). :)

    Edit.
    That does however delete all data which might not be what you want (reading it again).
     
  46. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    809
    I'm trying to create a custom generic property editor for a "filter" class, much like your example, with one difference: I want to display a checkbox before the property name. I got it working:



    However, I'd like to relay the attributes to the inline inspector.

    For example, in the previous example, "dolor" is defined as:

    Code (CSharp):
    1. [InspectorRange(0, 10)]
    2. public Filter<float> dolor { get; private set; } = new Filter<float>();
    3.  
    But InspectorRange isn't applied, with the associated warning:

    Code (CSharp):
    1. Failed to create attribute property editor Filter`1[System.Single] dolor for FullInspector.Modules.InspectorRange.InspectorRangeAttributeEditor`1[TElement]
    How could I achieve that?

    Here's my code:

    Filter.cs:

    Code (CSharp):
    1. public class Filter<T>
    2. {
    3.     public bool enabled { get; set; }
    4.     public T value { get; set; }
    5. }
    6.  

    FilterEditor.cs:

    Code (CSharp):
    1. [CustomPropertyEditor(typeof(Filter<>))]
    2. public class FilterEditor<T> : PropertyEditor<Filter<T>>
    3. {
    4.     private PropertyEditorChain valueEditor = PropertyEditor.Get(typeof(T), null);
    5.  
    6.     public override Filter<T> Edit(Rect region, GUIContent label, Filter<T> filter, fiGraphMetadata metadata)
    7.     {
    8.         var toggleRegion = new Rect(region.x, region.y, 16, 16);
    9.  
    10.         bool enabled = EditorGUI.Toggle(toggleRegion, filter.enabled);
    11.  
    12.         region.xMin += 15;
    13.        
    14.         T value = valueEditor.FirstEditor.Edit(region, label, filter.value, metadata.Enter("value"));
    15.  
    16.         return new Filter<T>
    17.         {
    18.             enabled = enabled,
    19.             value = value
    20.         };
    21.     }
    22.  
    23.     public override float GetElementHeight(GUIContent label, Filter<T> filter, fiGraphMetadata metadata)
    24.     {
    25.         return valueEditor.FirstEditor.GetElementHeight(label, filter.value, metadata.Enter("value"));
    26.     }
    27. }
    28.  
     
  47. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    I dug into this, and I believe that ultimately this is caused by a stripping issue that you'll have to fix on your end by adding metadata to Unity so it doesn't strip the required classes.

    Diagnosing this though is a bit difficult, because some of the Full Serializer error reporting wasn't as good as it should have been. I've fixed this and will upload a new build tonight that you can try out.
     
  48. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Does "Window/Full Inspector/Developer/Save All" do the trick? The data should also get cleared after you use the inspector on the object.

    You can visualize the serialized state with alt-d or "Window/Full Inspector/Show Serialized State".
     
  49. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Does this still happen without PrefabEvolution?
     
  50. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    602
    Ah, this is an interesting design constraint I've never thought about / had a request for. Unfortunately, with the current attribute editor design it isn't easily doable.

    I'm planning on rewriting the attribute editor system in one of the next two major updates (the next major update is likely to be multi-object editing, and after that the better attribute editor system); I'll try to add support for something like this.

    For the time being, I think the only real workaround is to define your own attribute that mirrors InspectorRange. Sorry about that :(.
     
    LazloBonin likes this.