ConMan - Extensible XML based data separation tool with EditorGUI

ConMan

What is ConMan
ConMan is an Editor-GUI based data-separation solution for creating configuration variables saved automatically to XML and loaded at runtime for use in any of your scripts. It allows for the creation and modification of these variables through an editor window as opposed to hand-writing/editing XML files.

How does it work?
Simply open the ConMan editor window (Window → ConMan Editor) and start adding categories and variables to your XML. Whenever you make an update, the XML is automatically updated as well (and the assets are refreshed as needed to ensure Unity is always up to date on the changes). You can access these variables with static functions like:

ConMan.GetString("id");
ConMan.GetString("id", "default value");
ConMan.GetFloat("id");

How can I add support for my own data-types?
ConMan was designed specifically with extensibility in mind. I toyed around with a few solutions before landing on my current implementation. Basically, for every data type you will add a new wrapper class that extends ConManElement and has a few specific delegates in it (for editor support, serialization and deserialization).

In addition, you’ll need functions for actually accessing your custom data types. There are three ways you can add these functions.

1: Edit ConMan.cs and add them manually. This is the cleanest, as it allows you to use ConMan.GetYourDatatype() - however, it is requires you maintain it after possible version updates.

2: C# Extension Methods. Sadly, C# does not support static extension methods. Instead, we need to add these methods to an instance of ConMan. An empty instance is already in the code (but not instantiated if not used. With this you can add your own methods in the following format: ConMan.Instance.GetDatatype(“”) - without having to edit ConMan itself.

3: Wrapper Class. You can also maintain your own wrapper class for ConMan that simply adds your own static functions and access all the values through your wrapper class. (for example KyleConstants.GetDatatype). This has the advantage of not requiring separate maintainable from the main class, but also not requiring the extra .Instance. as the extension methods.

Currently Supported Types

  • string
  • bool
  • float
  • int
  • Vector2
  • Vector3
  • Vector4
  • Quaternion (inspector needs work)

What’s Next?

  • Improve editor appearance/functionality
  • Add support for community-requested data types

Wishlist

  • Allow for resizable comment boxes (2dfxman)
  • JSON Support (GennadiyKorol)
  • Auto-generated completion static code-completion helper class (GennadiyKorol)

Example Video (this project is included in the current release)

Current Release
1.02 Changelog

  • Fixed an issue preventing the addition of new major categories.
  • “Add Category” now always adds a major category
  • In the content window for every category there is now an “Add Sub-Category” button

1.01 Changelog

  • Added GetVector2 method
  • Added GetVector3 method
  • Added GetVector4 method
  • Added GetQuaternion method

Price/Availability
For the alpha/beta stages ConMan will be available free of charge in this thread. It may potentially go commercial in the future (depending on how much work goes into the editor GUI mostly), but for now that is not planned. When I make a firm decision to keep ConMan free permanently I will host the project on GitHub publicly to allow anyone to fork it as desired.

For now, feel free to use ConMan in any of your Unity projects - free or commercial. The currently free version will never go paid; only new versions will be charged for (if I decide to go in that direction at all), so do not worry about using the tool and losing access to it at a later date. However, you are not free to resell ConMan in any form (edited or otherwise).

597335–21293–$ConMan-Alpha-1.02.unitypackage (19 KB)

Hello Kyle,

This looks like a useful extension to the editor. I’ve downloaded it and tried it out, and it works great.

Until I try to compile the project. Then it comes up with an error:

Assets/Plugins/KVS/ConMan/Elements/ConManBool.cs(4,7): error CS0246: The type or namespace name `UnityEditor’ could not be found. Are you missing a using directive or an assembly reference?

Any ideas?

Just remove that from the top of the “using UnityEditor” at the top of the ConManBool.cs file. That should resolve your problem. I have never used his product. However, I did get that error with my own product, UniDDatabase. That’s how I was able to get my file to compile correctly.

Sorry, I ran into a problem with this that I have yet to find an acceptable solution for - so development kind of halted (for the built in data types everything works as expected, but I ran into an issue with adding custom, project-specific data types).

I did solve this particular issue before putting development on the back burner though, through conditional compilation. Anyway, here’s the latest version with AutoMan disabled.

There are also tons of other improvements in this version - I highly suggest it over the older version (the editor is much better at least).

One of the big goals of ConMan was to allow users to easily add their own custom data types to the editor, which ran into a snag - I also got incredibly busy with work (and I am teaching a course this semester which added even more to my schedule).

It was my intent to stick this on the Asset store free of charge, but I never got it to a state that it looked/performed clean enough to bother submitting it. I’ll get it on there eventually though - but for now it’s available on the forums here free anyway.

700178–25230–$ConMan-Alpha-1.11.unitypackage (51.5 KB)