Skip to content

Configuration

Jeff Campbell edited this page Oct 28, 2020 · 1 revision

Configuration

The GenesisSettings asset itself is a simple list of KeyValuePairs of strings much like a properties or config file. Additional settings can be added to it by developers by implementing the IConfigurable interface while additional inspector UI can drawn to expose custom properties by creating an ISettingsDrawer implemented type.

Adding new settings to GenesisSettings

The GenesisSettings asset itself is a simple list of KeyValuePairs of strings much like a properties or config file. Additional settings can be added to it by developers by implementing the IConfigurable interface while additional inspector UI can drawn to expose custom properties by implenementing the ISettingsDrawer interface.

	/// <summary>
	/// Represents methods for an EditorGUI Drawer for a set of properties on a 
	/// <see cref="GenesisSettings"/> instance. Enables custom drawing of zero or 
	/// more settings that will appear on the <see cref="GenesisSettings"/> inspector.
	/// </summary>
	public interface ISettingsDrawer
	{
		/// <summary>
		/// The display title for this drawer
		/// </summary>
		string Title { get; }

		/// <summary>
		/// Initializes any setup for the drawer prior to rendering any GUI.
		/// </summary>
		/// <param name="settings"></param>
		void Initialize(GenesisSettings settings);

		/// <summary>
		/// Draws the header GUI section
		/// </summary>
		/// <param name="settings"></param>
		void DrawHeader(GenesisSettings settings);

		/// <summary>
		/// Draws the body GUI section
		/// </summary>
		/// <param name="settings"></param>
		void DrawContent(GenesisSettings settings);
	}
Clone this wiki locally