diff --git a/BepInEx/Contract/Attributes.cs b/BepInEx/Contract/Attributes.cs index b19f19b..9ef80be 100644 --- a/BepInEx/Contract/Attributes.cs +++ b/BepInEx/Contract/Attributes.cs @@ -116,7 +116,7 @@ namespace BepInEx /// /// Retrieves the BepInPlugin metadata from a plugin type. /// - /// The plugin type. + /// The plugin type. /// The BepInPlugin metadata of the plugin type. public static BepInPlugin GetMetadata(Type pluginType) { diff --git a/BepInEx/Contract/BaseUnityPlugin.cs b/BepInEx/Contract/BaseUnityPlugin.cs index 23296b4..7781a46 100644 --- a/BepInEx/Contract/BaseUnityPlugin.cs +++ b/BepInEx/Contract/BaseUnityPlugin.cs @@ -9,17 +9,32 @@ namespace BepInEx /// public abstract class BaseUnityPlugin : MonoBehaviour { + /// + /// Information about this plugin as it was loaded. + /// + public BepInPlugin Metadata { get; } + + /// + /// Logger instance tied to this plugin. + /// protected ManualLogSource Logger { get; } + /// + /// Default config file tied to this plugin. The config file will not be created until + /// any settings are added and changed, or is called. + /// protected ConfigFile Config { get; } + /// + /// Create a new instance of a plugin and all of its tied in objects. + /// protected BaseUnityPlugin() { - var metadata = MetadataHelper.GetMetadata(this); + Metadata = MetadataHelper.GetMetadata(this); - Logger = Logging.Logger.CreateLogSource(metadata.Name); + Logger = Logging.Logger.CreateLogSource(Metadata.Name); - Config = new ConfigFile(Utility.CombinePaths(Paths.ConfigPath, metadata.GUID + ".cfg"), false); + Config = new ConfigFile(Utility.CombinePaths(Paths.ConfigPath, Metadata.GUID + ".cfg"), false, this); } } } \ No newline at end of file