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

Free fully featured trial here (v2.6.2)!

2.6 has been released! Make sure to update!

Inspect Everything

Full Inspector allows you to edit and serialize the full range of .NET types using the Unity inspector. The following kind of types are supported:

Full Inspector makes the inspector “just work” with your complex object graph.

Video Introduction

The following video demonstrates some of the core features of Full Inspector.

The audio is slightly quiet, so you might need to turn your volume up.

Serialize Everything

Full Inspector also allows provides clean integration of Full Serializer, Json.NET, protobuf-net, BinaryFormatter, or your own custom solution using a simple integration API.

Full Inspector makes Json.NET, protobuf-net, or BinaryFormatter integrate wonderfully into Unity. If you would have annotated a type with [Serializable] before, then annotate it with the serializer’s annotations. It’s that simple.

Usage

Using Full Inspector is extremely simple. When you’re adding a new MonoBehaviour or ScriptableObject, simply derive from BaseBehavior (or BaseScriptableObject) instead of MonoBehaviour, and suddenly you’ll be able to use structs, interfaces, dictionaries, and general generic types!

The default serializer is Json.NET. If Unity would have previously required you to add a [Serializable] annotation, then you just need to annotate that type with Json.NET annotations. There is a similar story for protobuf-net, BinaryFormatter, etc.

You can also write custom PropertyEditors, which are extremely similar to Unity’s PropertyDrawer type. Please see the samples and or the manual for an explanation of how to write property editors. Don’t worry though, it isn’t complicated.

Get it!

Full Inspector is available on the Asset Store here. Please find the website here and the guide here.

A free trial here is now available. It includes all of Full Inspector, except there are two limitations:

  • Unity will error when publishing a build
  • Source code is not available

To install, simply unzip the downloaded zip file into your Unity Assets folder. Make sure to backup first!

Of course, full source code is included with this asset when you purchase from the Asset Store.

2 Likes

Hey sient, any updates to this?

It’s been out for 2-3 days. Here’s the official website: Full Inspector

I’m just dropping by to draw attention to this very well made product. It’s a must-have for programmers in my opinion. With support for serialization of interfaced fields, it allows you to design more intricate / modular / encapsulated object models and still fully leverage the inspector. I wish Unity would provide this feature built-in!

@sient, it sounds good. Are there any performance considerations when using in mobile apps? Also, any conflict issues as I’m already using JSON .NET for Unity.

My plan is to do a performance pass for 1.3 or 1.4. I haven’t been having any perf issues thus far, but there is always room for optimization. The runtime code is pretty minimal and mainly just passes work off to the serializer of choice.

If you really need fast performance, then I’d recommend using protobuf-net instead of Json.NET.

Awesome! There will be no conflicts; you just need to delete the folder “FullInspector/FullInspector/Serializers/JsonNet/DLLs”.

Edit: There are currently a few minor build issues with Json.NET for Unity from Parent Element; they are simple to resolve manually and will be dealt-with in version 1.3 (current eta is 3/7/2014).

@sient, are they any issues when using a particular Stripping Level on iOS?

Very cool asset,

Wondering if it can use EasySave 2 from the asset store ?

Edit: Which is more performant, EasySave2 or Json.NET from the asset store?

  1. Are there Example projects showing how to save/load for various commonly encountered use cases ?
  2. Video tutorials ?
  3. Trial version ?

Cheers.

Sure, you can use EasySave 2 from the asset store. However, it looks like EasySave 2 only supports writing the serialized data out to a file, which makes it significantly less useful. I’ve written a sample that demonstrates how to use EasySave 2 here. I don’t have access to EasySave 2, however, and this is just what I’ve been able to gleam from the documentation.

I’m not sure which is faster, Json.NET or EasySave 2. If you’re looking for performance, I would highly recommend that you use protobuf-net; Full Inspector ships with a serialization plug-in for it.

Yep, there are lots of samples. I plan on doing some video tutorials down the road, but right now there is lots of documentation on the website. I may release a trial version, but it will likely lack any serialization support.

Thanks! Let me know if you have any other questions.

Strip assemblies and Strip ByteCode appear to work at the moment (potentially micro mscorlib down the road), but more investigation is needed. I’ll update this post when I have more information.

Thanks for checking out EasySave2.

Does Protobuf-net support all unity platforms. Desktop, Console, IOS, Android, WinRT ?

Have you battle tested protobuf-net in a complex project?
The reason is that I just checked the project page and they seem to have lots of issues outstanding. Also the project doesn’t seem to have been updated since 2010. Edit: sorry, Sept 2013.

I saw the documentation page but really need working examples to see how it actually works with the various Serialization packages. If this package does the job, it would be totally awesome. A solid Serialization framework that rules them all.

Edit: Can you make a video showing the various saving/loading use cases ?

Cheers.

Forgot to ask an very important question:

Does the supported Serialization solution working for both in-editor and during run time?

protobuf-net is extremely mature and is heavily used in the industry.

Currently I’m working to get it working perfectly on iOS without manual user intervention. It’s doable right now, but it requires a precompilation step which I’d like to automate.

There are lots of included samples. I can probably put them up on a separate github repository (but this will likely not be until I push out 1.3). For now, here are a few samples that each use a different serializer.

Sure, but I don’t have time at the moment. It’ll probably be a week or two until I get the opportunity.

Absolutely. It would be awful if it did not.

Thanks.

Let me know if you have any more questions.

“There are lots of included samples. I can probably put them up on a separate github repository (but this will likely not be until I push out 1.3). For now, here are a few samples that each use a different serializer.”

What I mean by examples is more in-depth.

Say if you are using Protobuf.

  1. A demo scene with 4 Gos
  2. Go1 has unity component
  3. Go2 has simple custom component
  4. Go3 has complex custom component, class, and data structures.

Serialize the scene with these 4 Gos, Change the go’s properties, Load back the saved Gos.

Serialization seamlessly interops with Unity. You don’t need to do anything special, so in that regard there is nothing to sample. So for your example, you just add the annotations and it just works, even if some of the components don’t derive from BaseBehavior (though then they won’t be able to use protobuf-net on themselves or get an awesome inspector).

If you are modifying a behavior in the editor that is not the selected editor, then you need to call RestoreState/SaveState (or enable reserailization serialization of everything in the settings); I can add a sample for this.

I think a quick 5 min video will really help to understand how the package works.

Awesome news! I’m going to be submitting a 2.0 update in a few days. I’ve added some really awesome new features that require a change in serialization format.

  • Ref<> is gone, forever.
  • BinaryFormatter is now supported as a serializer
  • There is also an experimental easysave-2 serializer
  • Simple, free, and easy serialization support for AOT platforms such as iOS (via BinaryFormatter, protobuf-net via a data-type-only (DTO) assembly, or Json.NET if purchased).
  • Bug fixes :slight_smile:

Serialization has become even easier. Assuming that you’re using the BinaryFormatter serializer by default, then this code below serializes perfectly.

public interface IInterface { }

[Serializable]
public class Derived1 : IInterface {
    public int A;
}

[Serializable]
public class Derived2 : IInterface {
    public int B;
}

[Serializable]
public struct Struct {
    public GameObject GameObject;
    public Transform Transform;
}

public class BinaryFormatterStructDemoBehavior : BaseBehavior {
    public IInterface MyInterface;
    public Struct SomeStruct;

    public enum Enum {
        ValueA, ValueB, ValueC
    }
    public Dictionary<Enum, string> EnumStringDict;
}

BinaryFormatterStructDemoBehavior will generate this awesome inspector:

Thanks! Let me know if you have any questions.

Great news.

“protobuf-net via a data-type-only (DTO) assembly”,

What does this actually mean?

I was wondering about the differences between BinaryFormatter and ProtoBuf and found this article:

http://stackoverflow.com/questions/703073/what-are-the-deficiencies-of-the-built-in-binaryformatter-based-net-serializati

If you mean BinaryFormatter:

  • being based on fields, is very version intolerant; change private implementation details and it breaks (even just changing it to an automatically implemented property)
  • isn’t cross-compatible with other platforms
  • isn’t very friendly towards new fields
  • is assembly specific (metadata is burnt in)
  • is MS/.NET specific (and possibly .NET version specific)
  • isn’t obfuscation-safe
  • isn’t especially fast, or small output
  • doesn’t work on light frameworks (CF?/Silverlight)
  • has a depressing habit of pulling in things you didn’t expect (usually via events)

I’ve spent lots of time in this area, including writing a (free) implementation of Google’s “protocol buffers” serialization API for .NET; protobuf-net
This is:

Yep, I wouldn’t particularly recommend BinaryFormatter. However, it’s easy to use (protobuf-net requires compiling your serialized models into a separate assembly and the models cannot reference any of your behaviors/Assembly-CSharp/Assembly-JavaScript/Assembly-Boo types explicitly, otherwise the cross compiler crashes) and free (Json.NET for iOS costs $20).

Lets say that you have a BaseBehavior that references a struct which is serialized using protobuf-net. That struct needs to be placed in a separate assembly (data-type-only, or one that contains only data types) that protobuf-net can precompile or bake the serialization data into.

This precompiled assembly will be included directly into your project, providing the serialization models that protobuf-net uses. In this way, protobuf-net doesn’t have to do reflection/JIT compilation at runtime, which iOS does not support. I intend to write more documentation on how to do this, but as you can already tell, it isn’t as simple as BinaryFormatter or Json.NET.

Thanks

Updating the previous demo code to work with Json.NET (instead of BinaryFormatter) is also simple.

[JsonObject(MemberSerialization.OptIn)]
public interface IInterface { }

[JsonObject(MemberSerialization.OptIn)]
public class Derived1 : IInterface {
    [JsonProperty]
    public int A;
}

[JsonObject(MemberSerialization.OptIn)]
public class Derived2 : IInterface {
    [JsonProperty]
    public int B;
}

[JsonObject(MemberSerialization.OptIn)]
public struct Struct {
    [JsonProperty]
    public GameObject GameObject;
    [JsonProperty]
    public Transform Transform;
}

public class JsonNetDemoBehavior : BaseBehavior<JsonNetSerializer> {
    public IInterface MyInterface;
    public Struct SomeStruct;

    public enum Enum {
        ValueA, ValueB, ValueC
    }
    public Dictionary<Enum, string> EnumStringDict;
}