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).