Table of Contents
Handles embedded resources within Mod Helper mods
public static class ResourceHandler
Inheritance System.Object ResourceHandler
Map of created Audio Clips by Id
public static readonly Dictionary<string,AudioClip> AudioClips;
System.Collections.Generic.Dictionary<System.String,UnityEngine.AudioClip>
Map of loaded Asset Bundles by Id
public static readonly Dictionary<string,AssetBundle> Bundles;
System.Collections.Generic.Dictionary<System.String,UnityEngine.AssetBundle>
Map of raw embedded resource data by Id
public static readonly Dictionary<string,byte[]> Resources;
System.Collections.Generic.Dictionary<System.String,System.Byte[]>
Cache of created Sprites by Id
public static readonly Dictionary<string,Sprite> SpriteCache;
System.Collections.Generic.Dictionary<System.String,UnityEngine.Sprite>
Cache of created Textures by Id
public static readonly Dictionary<string,Texture2D> TextureCache;
System.Collections.Generic.Dictionary<System.String,UnityEngine.Texture2D>
Adds a texture that can be accessed as a Sprite via the given guid
public static void AddTexture(string guid, Texture2D texture);
guid
System.String
Texture id "ModName-TextureName"
texture
UnityEngine.Texture2D
The texture
Create an AudioClip from an mp3 file
public static AudioClip CreateAudioClip(NAudio.Wave.Mp3FileReader reader, string id);
reader
NAudio.Wave.Mp3FileReader
mp3 file reader
Id for AudioClip
UnityEngine.AudioClip
new AudioClip, or null if unsuccessful
Create an AudioClip from a wav file
public static AudioClip CreateAudioClip(NAudio.Wave.WaveFileReader reader, string id);
reader
NAudio.Wave.WaveFileReader
Wav file reader
Id for AudioClip
UnityEngine.AudioClip
new AudioClip, or null if unsuccessful
Creates a Sprite from a Texture2D
public static Sprite CreateSprite(this Texture2D texture, float pixelsPerUnit=10.8f);
texture
UnityEngine.Texture2D
Texture
pixelsPerUnit
System.Single
Pixels per Unit to use
UnityEngine.Sprite
new Sprite
Creates or gets a sprite from its Id
public static Sprite GetSprite(string id, float pixelsPerUnit=10.8f);
Sprite id "ModName-FileName" (no file extension)
pixelsPerUnit
System.Single
Pixels per Unit to use
UnityEngine.Sprite
The texture
Creates or gets a texture from its Id
public static Texture2D GetTexture(string id);
Texture id "ModName-FileName" (no file extension)
UnityEngine.Texture2D
The texture