Skip to Main Content
Table of Contents

BTD_Mod_Helper​.Api​.ModContent


BloonsTD6 Mod Helper

BTD_Mod_Helper.Api

ModContent Class

ModContent serves two major purposes:

  1. It is a base class for things that needs to be loaded via reflection from mods and given Ids,
    such as ModTower and ModUpgrade
  2. It is a utility class with methods to access instances of those classes and other resources
public abstract class ModContent :
BTD_Mod_Helper.Api.IModContent,
System.IComparable<BTD_Mod_Helper.Api.ModContent>

Inheritance System.Object  ModContent

Derived
ModCommand
ModSettings
ModTextOverride
ModDisplay
ModByteLoader
ModGameMenu
NamedModContent
ModVanillaContent

Implements IModContent, System.IComparable<ModContent>

Fields

ModContent.mod Field

The BloonsTD6Mod that this content was added by

public BloonsMod mod;

Field Value

BloonsMod

Properties

ModContent.Id Property

The id that this ModContent will be given; a combination of the Mod's prefix and the name

public string Id { get; }

Property Value

System.String

ModContent.Name Property

The name that will be at the end of the ID for this ModContent, by default the class name

public virtual string Name { get; }

Property Value

System.String

ModContent.Order Property

The order that this ModContent will be loaded/registered in by Mod Helper.
Useful for changing the ordering that it will appear in in-game relative to other content of this type in your mod,
or for making certain content load before others like may be necessary for sub-towers.
Default/0 will use arbitrary ordering.

protected virtual int Order { get; }

Property Value

System.Int32

Methods

ModContent.BloonID() Method

Gets the ID for the given ModBloon

public static string BloonID<T>()
    where T : BTD_Mod_Helper.Api.Bloons.ModBloon;

Type parameters

T

Returns

System.String

ModContent.CreateAudioClipReference(string) Method

Returns a new AudioClipReference that uses the given guid

public static AudioClipReference CreateAudioClipReference(string guid);

Parameters

guid System.String

The guid that you'd like to assign to the AudioClipReference

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.AudioClipReference

ModContent.CreateAudioSourceReference(string) Method

Returns a new AudioSourceReference that uses the given guid

public static AudioSourceReference CreateAudioSourceReference(string guid);

Parameters

guid System.String

The guid that you'd like to assign to the AudioSourceReference

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.AudioSourceReference

ModContent.CreateAudioSourceReference(string) Method

Gets an AudioSource reference for a given sound within a mod

public static AudioSourceReference CreateAudioSourceReference<T>(string name)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

The mod

Parameters

name System.String

Sound name (no .wav)

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.AudioSourceReference
An AudioSoundReference

ModContent.CreatePrefabReference(string) Method

Returns a new PrefabReference that uses the given guid

public static PrefabReference CreatePrefabReference(string guid);

Parameters

guid System.String

The guid that you'd like to assign to the PrefabReference

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.PrefabReference

ModContent.CreatePrefabReference() Method

Creates a Prefab Reference for a ModDisplay

public static PrefabReference CreatePrefabReference<T>()
    where T : BTD_Mod_Helper.Api.Display.ModDisplay;

Type parameters

T

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.PrefabReference

ModContent.CreateSpriteReference(string) Method

Returns a new SpriteReference that uses the given guid

public static SpriteReference CreateSpriteReference(string guid);

Parameters

guid System.String

The guid that you'd like to assign to the SpriteReference

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference

ModContent.Find(string) Method

Finds the loaded ModContent with the given Id and type T

public static T Find<T>(string id)
    where T : BTD_Mod_Helper.Api.ModContent;

Type parameters

T

Parameters

id System.String

Returns

T

ModContent.GameModeId() Method

Gets the ID for the given ModGameMode

public static string GameModeId<T>()
    where T : BTD_Mod_Helper.Api.Scenarios.ModGameMode;

Type parameters

T

Returns

System.String

ModContent.GetAudioClip(BloonsMod, string) Method

Gets an AudioClip from a mod by its name (no file extension included)

public static AudioClip GetAudioClip(BTD_Mod_Helper.BloonsMod mod, string name);

Parameters

mod BloonsMod

The mod

name System.String

Sound name (no .wav)

Returns

UnityEngine.AudioClip
a playable AudioClip

ModContent.GetAudioClip(string) Method

Gets an AudioClip from this mod by its name (no file extension included)

public AudioClip GetAudioClip(string name);

Parameters

name System.String

Sound name (no .wav)

Returns

UnityEngine.AudioClip
a playable AudioClip

ModContent.GetAudioClip(string) Method

Gets an AudioClip from a mod by its name (no file extension included)

public static AudioClip GetAudioClip<T>(string name)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

The mod

Parameters

name System.String

Sound name (no .wav)

Returns

UnityEngine.AudioClip
a playable AudioClip

ModContent.GetAudioSourceReference(BloonsMod, string) Method

Gets an AudioSource reference for a given sound within a mod

public static AudioSourceReference GetAudioSourceReference(BTD_Mod_Helper.BloonsMod mod, string name);

Parameters

mod BloonsMod

name System.String

Sound name (no .wav)

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.AudioSourceReference
An AudioSoundReference

ModContent.GetAudioSourceReference(string) Method

Gets an AudioSource reference for a given sound within this mod

public AudioSourceReference GetAudioSourceReference(string name);

Parameters

name System.String

Sound name (no .wav)

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.AudioSourceReference
An AudioSoundReference

ModContent.GetAudioSourceReference(string) Method

Gets an AudioSource reference for a given sound within a mod

public static AudioSourceReference GetAudioSourceReference<T>(string name)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

The mod

Parameters

name System.String

Sound name (no .wav)

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.AudioSourceReference
An AudioSoundReference

ModContent.GetBundle(BloonsMod, string) Method

Gets a bundle from a mod with the specified name (no file extension)

public static AssetBundle GetBundle(BTD_Mod_Helper.BloonsMod mod, string name);

Parameters

mod BloonsMod

name System.String

Returns

UnityEngine.AssetBundle

ModContent.GetBundle(string) Method

Gets a bundle from your mod with the specified name (no file extension)

protected AssetBundle GetBundle(string name);

Parameters

name System.String

Returns

UnityEngine.AssetBundle

ModContent.GetBundle(string) Method

Gets a bundle from the mod T with the specified name (no file extension)

public static AssetBundle GetBundle<T>(string name)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Parameters

name System.String

Returns

UnityEngine.AssetBundle

ModContent.GetContent() Method

Gets all loaded ModContent objects that are T or a subclass of T

public static System.Collections.Generic.List<T> GetContent<T>()
    where T : BTD_Mod_Helper.Api.ModContent;

Type parameters

T

Returns

System.Collections.Generic.List<T>

ModContent.GetDisplayGUID() Method

Gets the GUID (thing that should be used in the display field for things) for a specific ModDisplay

public static string GetDisplayGUID<T>()
    where T : BTD_Mod_Helper.Api.Display.ModDisplay;

Type parameters

T

Returns

System.String

ModContent.GetId(BloonsMod, string) Method

Gets the id of a resource by appending the mod's ID prefix to its name

public static string GetId(BTD_Mod_Helper.BloonsMod bloonsMod, string name);

Parameters

bloonsMod BloonsMod

name System.String

Returns

System.String

ModContent.GetId(string) Method

Gets the id of a resource by appending the mod's ID prefix to its name

public string GetId(string name);

Parameters

name System.String

Returns

System.String

ModContent.GetId(string) Method

Gets the id of a resource by appending the mod's ID prefix to its name

public static string GetId<T>(string name)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Parameters

name System.String

Returns

System.String

ModContent.GetInstance(Type) Method

Gets the official instance of a particular ModContent or BloonsTD6Mod based on its type

public static BTD_Mod_Helper.Api.IModContent GetInstance(System.Type type);

Parameters

type System.Type

The type to get the instance of

Returns

IModContent
The official instance of it

ModContent.GetInstance() Method

Gets the singleton instance of a particular ModContent or BloonsTD6Mod based on its type

public static T GetInstance<T>()
    where T : BTD_Mod_Helper.Api.IModContent;

Type parameters

T

The type to get the instance of

Returns

T
The singleton instance of it

ModContent.GetInstances() Method

Gets all loaded ModContent objects that are exactly of type T

public static System.Collections.Generic.List<T> GetInstances<T>()
    where T : BTD_Mod_Helper.Api.ModContent;

Type parameters

T

Returns

System.Collections.Generic.List<T>

ModContent.GetMod(string) Method

Gets a BloonsTD6Mod by its name, or returns null if none are loaded with that name

public static BTD_Mod_Helper.BloonsMod GetMod(string name);

Parameters

name System.String

Returns

BloonsMod

ModContent.GetSprite(BloonsMod, string, float) Method

Constructs a Sprite for a given texture name within a given mod

public static Sprite GetSprite(BTD_Mod_Helper.BloonsMod mod, string name, float pixelsPerUnit=10f);

Parameters

mod BloonsMod

name System.String

The file name of your texture, without the extension

pixelsPerUnit System.Single

The pixels per unit for the Sprite to have

Returns

UnityEngine.Sprite
A Sprite

ModContent.GetSprite(string, float) Method

Constructs a Sprite for a given texture name within this mod

protected Sprite GetSprite(string name, float pixelsPerUnit=10f);

Parameters

name System.String

The file name of your texture, without the extension

pixelsPerUnit System.Single

The pixels per unit for the Sprite to have

Returns

UnityEngine.Sprite
A Sprite

ModContent.GetSprite(string, float) Method

Constructs a Sprite for a given texture name within a given mod

public static Sprite GetSprite<T>(string name, float pixelsPerUnit=10f)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Parameters

name System.String

The file name of your texture, without the extension

pixelsPerUnit System.Single

The pixels per unit for the Sprite to have

Returns

UnityEngine.Sprite
A Sprite

ModContent.GetSpriteReference(BloonsMod, string) Method

Gets a sprite reference by name for a specific mod

public static SpriteReference GetSpriteReference(BTD_Mod_Helper.BloonsMod mod, string name);

Parameters

mod BloonsMod

The BloonsTD6Mod that the texture is from

name System.String

The file name of your texture, without the extension

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
A new SpriteReference

ModContent.GetSpriteReference(string) Method

Gets a sprite reference by name for this mod

protected SpriteReference GetSpriteReference(string name);

Parameters

name System.String

The file name of your texture, without the extension

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
A new SpriteReference

ModContent.GetSpriteReference(string) Method

Gets a sprite reference by name for a specific mod

public static SpriteReference GetSpriteReference<T>(string name)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Your mod's main BloonsTD6Mod extending class

Parameters

name System.String

The file name of your texture, without the extension

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
A new SpriteReference

ModContent.GetSpriteReferenceOrDefault(BloonsMod, string) Method

Gets a sprite reference by name for a specific mod, or if the mod does not include a texture with that name,
treats it as a vanilla sprite reference

public static SpriteReference GetSpriteReferenceOrDefault(BTD_Mod_Helper.BloonsMod mod, string name);

Parameters

mod BloonsMod

The BloonsTD6Mod that the texture is from

name System.String

The file name of your texture, without the extension

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
A new SpriteReference

ModContent.GetSpriteReferenceOrDefault(string) Method

Gets a sprite reference by name for a specific mod, or if the mod does not include a texture with that name,
treats it as a vanilla sprite reference

protected SpriteReference GetSpriteReferenceOrDefault(string name);

Parameters

name System.String

The file name of your texture, without the extension

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
A new SpriteReference

ModContent.GetSpriteReferenceOrDefault(string) Method

Gets a sprite reference by name for a specific mod, or if the mod does not include a texture with that name,
treats it as a vanilla sprite reference

public static SpriteReference GetSpriteReferenceOrDefault<T>(string name)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Your mod's main BloonsTD6Mod extending class

Parameters

name System.String

The file name of your texture, without the extension

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
A new SpriteReference

ModContent.GetSpriteReferenceOrNull(BloonsMod, string) Method

Gets a sprite reference by name for a specific mod, returning null if the texture hasn't currently been
loaded instead of an invalid SpriteReference

public static SpriteReference GetSpriteReferenceOrNull(BTD_Mod_Helper.BloonsMod mod, string name);

Parameters

mod BloonsMod

The BloonsTD6Mod that the texture is from

name System.String

The file name of your texture, without the extension

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
A new SpriteReference

ModContent.GetSpriteReferenceOrNull(string) Method

Gets a sprite reference by name for this mod, returning null if the texture hasn't currently been
loaded instead of an invalid SpriteReference

protected SpriteReference GetSpriteReferenceOrNull(string name);

Parameters

name System.String

The file name of your texture, without the extension

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
A new SpriteReference

ModContent.GetSpriteReferenceOrNull(string) Method

Gets a sprite reference by name for a specific mod, returning null if the texture hasn't currently been
loaded instead of an invalid SpriteReference

public static SpriteReference GetSpriteReferenceOrNull<T>(string name)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Your mod's main BloonsTD6Mod extending class

Parameters

name System.String

The file name of your texture, without the extension

Returns

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
A new SpriteReference

ModContent.GetTexture(BloonsMod, string) Method

Constructs a Texture2D for a given texture name within a mod

public static Texture2D GetTexture(BTD_Mod_Helper.BloonsMod bloonsMod, string fileName);

Parameters

bloonsMod BloonsMod

The mod that adds this texture

fileName System.String

The file name of your texture, without the extension

Returns

UnityEngine.Texture2D
A Texture2D

ModContent.GetTexture(string) Method

Constructs a Texture2D for a given texture name within this mod

protected Texture2D GetTexture(string fileName);

Parameters

fileName System.String

The file name of your texture, without the extension

Returns

UnityEngine.Texture2D
A Texture2D

ModContent.GetTexture(string) Method

Constructs a Texture2D for a given texture name within a mod

public static Texture2D GetTexture<T>(string fileName)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Parameters

fileName System.String

The file name of your texture, without the extension

Returns

UnityEngine.Texture2D
A Texture2D

ModContent.GetTextureBytes(BloonsMod, string) Method

Returns the Bytes associated with a texture.

public static byte[] GetTextureBytes(BTD_Mod_Helper.BloonsMod bloonsMod, string fileName);

Parameters

bloonsMod BloonsMod

The mod that adds this texture.

fileName System.String

The file name of your texture, without the extension.

Returns

System.Byte[]
The bytes associated with the texture.

ModContent.GetTextureBytes(string) Method

Returns the Bytes associated with a texture.

protected byte[] GetTextureBytes(string fileName);

Parameters

fileName System.String

The file name of your texture, without the extension.

Returns

System.Byte[]
The bytes associated with the texture.

ModContent.GetTextureBytes(string) Method

Returns the Bytes associated with a texture.

public static byte[] GetTextureBytes<T>(string fileName)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Parameters

fileName System.String

The file name of your texture, without the extension.

Returns

System.Byte[]
The bytes associated with the texture.

ModContent.GetTextureGUID(BloonsMod, string) Method

Gets a texture's GUID by name for a specific mod

public static string GetTextureGUID(BTD_Mod_Helper.BloonsMod mod, string fileName);

Parameters

mod BloonsMod

The BloonsTD6Mod that the texture is from

fileName System.String

The file name of your texture, without the extension

Returns

System.String
The texture's GUID

ModContent.GetTextureGUID(string) Method

Gets a texture's GUID by name for this mod


Returns null if a Texture hasn't been loaded with that name

public string GetTextureGUID(string name);

Parameters

name System.String

The file name of your texture, without the extension

Returns

System.String
The texture's GUID

ModContent.GetTextureGUID(string) Method

Gets a texture's GUID by name for a specific mod, to be used in SpriteReferences


Returns null if a Texture hasn't been loaded with that name

public static string GetTextureGUID<T>(string name)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Your mod's main BloonsTD6Mod extending class

Parameters

name System.String

The file name of your texture, without the extension

Returns

System.String
The texture's GUID

ModContent.GetTowerModel(int, int, int) Method

Gets the TowerModel for a ModTower at a specific tier level

public static TowerModel GetTowerModel<T>(int top=0, int mid=0, int bot=0)
    where T : BTD_Mod_Helper.Api.Towers.ModTower;

Type parameters

T

The ModTower type

Parameters

top System.Int32

The top path tier

mid System.Int32

The middle path tier

bot System.Int32

The bottom path tier

Returns

Il2CppAssets.Scripts.Models.Towers.TowerModel
The tower name/id

ModContent.GetTowerSet() Method

Gets the fabricated TowerSet enum value for a ModTowerSet

public static TowerSet GetTowerSet<T>()
    where T : BTD_Mod_Helper.Api.Towers.ModTowerSet;

Type parameters

T

Returns

Il2CppAssets.Scripts.Models.TowerSets.TowerSet

ModContent.HasMod(string, BloonsMod) Method

Returns whether a mod with the given name is installed, and pass it to the out param if it is

public static bool HasMod(string name, out BTD_Mod_Helper.BloonsMod bloonsMod);

Parameters

name System.String

bloonsMod BloonsMod

Returns

System.Boolean

ModContent.HasMod(string) Method

Returns whether a mod with the given name is installed

public static bool HasMod(string name);

Parameters

name System.String

Returns

System.Boolean

ModContent.Load(ModContent) Method

Creates the Instances of a ModContent type within a Mod and adds them to ModContentInstances

private static System.Collections.Generic.IEnumerable<BTD_Mod_Helper.Api.ModContent> Load(BTD_Mod_Helper.Api.ModContent instance);

Parameters

instance ModContent

Returns

System.Collections.Generic.IEnumerable<ModContent>

ModContent.Localize(BloonsMod, string, string) Method

Registers some text to the LocalizationManager using the given key (combined with your mod id) for use with
the built in language system. NK texts components will Il2Cpp.NK_TextMeshProUGUI.AutoLocalize your keys.

public static string Localize(BTD_Mod_Helper.BloonsMod mod, string key, string text);

Parameters

mod BloonsMod

The mod

key System.String

The localization key

text System.String

The default English text

Returns

System.String
The Localization key

ModContent.Localize(BloonsMod, string) Method

Registers some text to the LocalizationManager using the given key (combined with your mod id) for use with
the built in language system. NK texts components will Il2Cpp.NK_TextMeshProUGUI.AutoLocalize your keys.

public static string Localize(BTD_Mod_Helper.BloonsMod mod, string keyAndText);

Parameters

mod BloonsMod

The mod

keyAndText System.String

Returns

System.String
The Localization key

ModContent.Localize(string, string) Method

Registers some text to the LocalizationManager using the given key (combined with your mod id) for use with
the built in language system. NK texts components will Il2Cpp.NK_TextMeshProUGUI.AutoLocalize your keys.

public string Localize(string key, string text);

Parameters

key System.String

The localization key

text System.String

The default English text

Returns

System.String
The Localization key

ModContent.Localize(string) Method

Registers some text to the LocalizationManager using the given key (combined with your mod id) for use with
the built in language system. NK texts components will Il2Cpp.NK_TextMeshProUGUI.AutoLocalize your keys.

public string Localize(string keyAndText);

Parameters

keyAndText System.String

Returns

System.String
The Localization key

ModContent.Localize(string, string) Method

Registers some text to the LocalizationManager using the given key (combined with your mod id) for use with
the built in language system. NK texts components will Il2Cpp.NK_TextMeshProUGUI.AutoLocalize your keys.

public static string Localize<T>(string key, string text)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Parameters

key System.String

The localization key

text System.String

The default English text

Returns

System.String
The Localization key

ModContent.Localize(string) Method

Registers some text to the LocalizationManager using the given key (combined with your mod id) for use with
the built in language system. NK texts components will Il2Cpp.NK_TextMeshProUGUI.AutoLocalize your keys.

public static string Localize<T>(string keyAndText)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

Parameters

keyAndText System.String

Returns

System.String
The Localization key

ModContent.RoundSetId() Method

Gets the ID for the given ModRoundSet

public static string RoundSetId<T>()
    where T : BTD_Mod_Helper.Api.Bloons.ModRoundSet;

Type parameters

T

Returns

System.String

ModContent.TextureExists(BloonsMod, string) Method

Gets whether a texture with a given name has been loaded by the Mod Helper for a mod

public static bool TextureExists(BTD_Mod_Helper.BloonsMod bloonsMod, string name);

Parameters

bloonsMod BloonsMod

The mod to look in

name System.String

The file name of your texture, without the extension

Returns

System.Boolean

ModContent.TextureExists(string) Method

Gets whether a texture with a given name has been loaded by the Mod Helper for this mod

protected bool TextureExists(string name);

Parameters

name System.String

The file name of your texture, without the extension

Returns

System.Boolean

ModContent.TextureExists(string) Method

Gets whether a texture with a given name has been loaded by the Mod Helper for a mod

public static bool TextureExists<T>(string name)
    where T : BTD_Mod_Helper.BloonsMod;

Type parameters

T

The mod to look in

Parameters

name System.String

The file name of your texture, without the extension

Returns

System.Boolean

ModContent.TowerID(int, int, int) Method

Gets the internal tower name/id for a ModTower

public static string TowerID<T>(int top=0, int mid=0, int bot=0)
    where T : BTD_Mod_Helper.Api.Towers.ModTower;

Type parameters

T

The ModTower type

Parameters

top System.Int32

The top path tier

mid System.Int32

The middle path tier

bot System.Int32

The bottom path tier

Returns

System.String
The tower name/id

ModContent.TryFind(string, T) Method

Finds the loaded ModContent with the given Id and type T

public static bool TryFind<T>(string id, out T result)
    where T : BTD_Mod_Helper.Api.ModContent;

Type parameters

T

Parameters

id System.String

result T

Returns

System.Boolean

ModContent.UpgradeID() Method

Gets the internal upgrade name/id for a ModUpgrade

public static string UpgradeID<T>()
    where T : BTD_Mod_Helper.Api.Towers.ModUpgrade;

Type parameters

T

The ModUpgrade type

Returns

System.String
The upgrade name/id

To learn how to download BTD Mod Helper and install mods, click here