Skip to Main Content

BTD_Mod_Helper​.Extensions​.ImageExt


BloonsTD6 Mod Helper

BTD_Mod_Helper.Extensions

ImageExt Class

Extensions for Images

public static class ImageExt

Inheritance System.Object  ImageExt

Methods

ImageExt.LoadSprite(this Image, SpriteReference) Method

Loads a sprite reference to this image

public static void LoadSprite(this Image image, SpriteReference spriteReference);

Parameters

image UnityEngine.UI.Image

spriteReference Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference

ImageExt.SaveToPNG(this Image, string) Method

Saves an image as a PNG files
Coded in a robust manner that should work for all images, including those with multiple sprites on them being used

public static void SaveToPNG(this Image image, string filePath);

Parameters

image UnityEngine.UI.Image

filePath System.String

Absolute file path on the machine to save the file to

ImageExt.SetSprite(this Image, Sprite) Method

Set the sprite for this image

public static void SetSprite(this Image image, Sprite sprite);

Parameters

image UnityEngine.UI.Image

sprite UnityEngine.Sprite

Sprite to change image to

ImageExt.SetSprite(this Image, SpriteReference) Method

Set the sprite for this image

public static void SetSprite(this Image image, SpriteReference spriteReference);

Parameters

image UnityEngine.UI.Image

spriteReference Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference

Sprite to change image to

ImageExt.SetSprite(this Image, string) Method

Set the sprite for this image

public static void SetSprite(this Image image, string guid);

Parameters

image UnityEngine.UI.Image

guid System.String

Sprite to change image to

ImageExt.SetSpriteFromAtlas(this Image, string, string) Method

Sets the sprite of this image to one with the given name in the named sprite atlas

public static void SetSpriteFromAtlas(this Image image, string atlas, string spriteName);

Parameters

image UnityEngine.UI.Image

atlas System.String

spriteName System.String

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