Skip to Main Content

BTD_Mod_Helper​.Api​.Internal​.ResourceHandler


BloonsTD6 Mod Helper

BTD_Mod_Helper.Api.Internal

ResourceHandler Class

Handles embedded resources within Mod Helper mods

public static class ResourceHandler

Inheritance System.Object  ResourceHandler

Fields

ResourceHandler.AudioClips Field

Map of created Audio Clips by Id

public static readonly Dictionary<string,AudioClip> AudioClips;

Field Value

System.Collections.Generic.Dictionary<System.String,UnityEngine.AudioClip>

ResourceHandler.Bundles Field

Map of loaded Asset Bundles by Id

public static readonly Dictionary<string,AssetBundle> Bundles;

Field Value

System.Collections.Generic.Dictionary<System.String,UnityEngine.AssetBundle>

ResourceHandler.Resources Field

Map of raw embedded resource data by Id

public static readonly Dictionary<string,byte[]> Resources;

Field Value

System.Collections.Generic.Dictionary<System.String,System.Byte[]>

Methods

ResourceHandler.CreateAudioClip(Mp3FileReader, string) Method

Create an AudioClip from an mp3 file

public static AudioClip CreateAudioClip(NAudio.Wave.Mp3FileReader reader, string id);

Parameters

reader NAudio.Wave.Mp3FileReader

mp3 file reader

id System.String

Id for AudioClip

Returns

UnityEngine.AudioClip
new AudioClip, or null if unsuccessful

ResourceHandler.CreateAudioClip(WaveFileReader, string) Method

Create an AudioClip from a wav file

public static AudioClip CreateAudioClip(NAudio.Wave.WaveFileReader reader, string id);

Parameters

reader NAudio.Wave.WaveFileReader

Wav file reader

id System.String

Id for AudioClip

Returns

UnityEngine.AudioClip
new AudioClip, or null if unsuccessful

ResourceHandler.CreateSprite(this Texture2D, float) Method

Creates a Sprite from a Texture2D

public static Sprite CreateSprite(this Texture2D texture, float pixelsPerUnit=10.8f);

Parameters

texture UnityEngine.Texture2D

Texture

pixelsPerUnit System.Single

Pixels per Unit to use

Returns

UnityEngine.Sprite
new Sprite

ResourceHandler.GetTexture(string) Method

Creates or gets a texture from its Id

public static Texture2D GetTexture(string id);

Parameters

id System.String

Texture id "ModName-FileName" (no file extension)

Returns

UnityEngine.Texture2D
The texture

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