IdleSlayerMods.Common 1.2.5-ML

This is a prerelease version of IdleSlayerMods.Common.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package IdleSlayerMods.Common --version 1.2.5-ML
                    
NuGet\Install-Package IdleSlayerMods.Common -Version 1.2.5-ML
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IdleSlayerMods.Common" Version="1.2.5-ML" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IdleSlayerMods.Common" Version="1.2.5-ML" />
                    
Directory.Packages.props
<PackageReference Include="IdleSlayerMods.Common" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IdleSlayerMods.Common --version 1.2.5-ML
                    
#r "nuget: IdleSlayerMods.Common, 1.2.5-ML"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package IdleSlayerMods.Common@1.2.5-ML
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=IdleSlayerMods.Common&version=1.2.5-ML&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=IdleSlayerMods.Common&version=1.2.5-ML&prerelease
                    
Install as a Cake Tool

Core library for idle slayer mods

Getting started

In order to get started, simply download the mod from Nexus or from Nuget, then include it as a reference in your plugin project.

Current features:

Mod Utils

static class ModUtils Mod utility class, used for registering custom components
GameObject RegisterComponent<T> : where T is Component Registers a unity component into the mod loader so that it is usable in the code
static bool DebugMode Returns the config entry value for DebugMode. (READONLY)

Your unity components must be registered via this method before they are usable in your code. RegisterComponent() can be called at any point, but must be called at any point before accessing your component.

For example:

var obj = new GameObject();
obj.AddComponent<MyCustomBehaviour>();

This code will break. The code below will also break, as the component is registered AFTER the call to add it to a GameObject

var obj = new GameObject();
obj.AddComponent<MyCustomBehaviour>();

ModUtils.RegisterComponent<MyCustomBehaviour>();

So that leaves, of course, registering your component BEFORE adding it to a GameObject

ModUtils.RegisterComponent<MyCustomBehaviour>();

var obj = new GameObject();
obj.AddComponent<MyCustomBehaviour>();

Logger Extension

static class LoggerExtension MelonLoader logging extension class
static void Debug(string message) Can be accessed by calling it from a logging instance. Only logs if DebugMode is true in config file.

Mod Helper

class ModHelper : MonoBehaviour Instantiated Mod Helper that gets injected into the Game scene
event ModHelperMounted Event that gets fired when the class has successfully been added to the Game scene
void ShowNotification() Display a message in the center of the screen, similar to an event message
void ShowDialog() Show a customisable dialog popup message
void ShowAchievement() Show a customisable achievement style popup
void AddPanelButton() Adds a button to the info panel. The same place as Achievements, Options, etc.
void CreateSettingsToggle() Creates a toggle in the in-game settings menu panel.

Achievement Helper

class AchievementHelper Achievement helper class to manage achievements
static Achievement AddAchievement() Instantiates a new Achievement scriptable object, and returns this object

BaseConfig:

abstract class BaseConfig Base configuration class which can be inherited from
abstract void SetBindings Takes in a ConfigFile and assigns it to the class instance
virtual MelonPreferences_Entry<T> Bind Creates and assigns a new setting of type T

Planned:

  • Modded Achievement section in options
  • Global list of modded achievements that can be appended to
  • Simple UI button creation
  • Custom random box events

Usage

The ModHelper class is currently only accessible in the Game scene of Idle Slayer.

In order to make use of the ModHelper behaviour object, you can either:

  1. Make use of the ModHelperMounted event.
  2. Find the injected GameObject and use GetComponent<ModHelper>().

Using the ModHelperMounted event (Method 1)

In your Plugin.cs, you'll need to add a static ModHelper variable. This is so that your MonoBehaviour classes will have access to the helper, via the Plugin class.

You then need to create a event delegate for the event handler which will return the ModHelper instance that exists in the game.

See example:
using IdleSlayerMods.Common;
public class Plugin : MelonMod
{
    internal static ModHelper ModHelperInstance;
    
    public override void OnInitializeMelon()
    {
        ModHelper.ModHelperMounted += SetModHelperInstance;
    }

    private static void SetModHelperInstance(ModHelper instance) => ModHelperInstance = instance;
}

To access within a MonoBehaviour script will then be as simple as:

using UnityEngine;
public class CustomBehaviour : MonoBehaviour
{
    void Start()
    {
        Plugin.ModHelperInstance.ShowNotification("Custom message!");
    }
}

The ModHelperMounted event happens in the Awake lifecycle, thus it is recommended to access the instance from Start() or any point after that to avoid potential race conditions.

Using BaseConfig

Using the base config simplifies mod settings creation.

See Using BaseConfig

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.0-ML 38 10/17/2026
1.3.2-ML 86 6/22/2026
1.3.1-ML 67 3/26/2026
1.3.0-ML 88 3/19/2026
1.2.5-ML 124 2/24/2026
1.2.4-ML 77 2/20/2026
1.2.3-ML 120 1/30/2026
1.2.2-ML 101 1/6/2026
1.2.1-ML 84 10/4/2025
1.2.0-ML 115 5/23/2025
1.1.9-ML 136 4/18/2025
1.1.8-ML 182 4/10/2025
1.1.7-ML 269 4/10/2025 1.1.7-ML is deprecated because it has critical bugs.
1.1.6-ML 161 4/10/2025
1.1.5-ML 178 4/9/2025
1.1.4-ML 145 3/27/2025
1.1.3-ML 468 3/26/2025
1.1.2-ML 471 3/26/2025
1.1.1-ML 496 3/25/2025
Loading failed