Skip to Main Content

BTD_Mod_Helper​.Extensions​.RendererExt


BloonsTD6 Mod Helper

BTD_Mod_Helper.Extensions

RendererExt Class

Extensions for unity renderers

public static class RendererExt

Inheritance System.Object  RendererExt

Methods

RendererExt.AdjustHSV(this Renderer, float, float, float, Nullable, float) Method

Applies a HSV adjustment, shifting its Hue/Saturation/Value(light)

public static void AdjustHSV(this Renderer renderer, float hueAdjust, float saturationAdjust, float valueAdjust, System.Nullable<Color> targetColor=null, float threshold=0.05f);

Parameters

renderer UnityEngine.Renderer

hueAdjust System.Single

Amount between -180 and 180 to add to Hue

saturationAdjust System.Single

Amount between -1 and 1 to add to the saturation

valueAdjust System.Single

Amount between -1 and 1 to add to the value (light)

targetColor System.Nullable<UnityEngine.Color>

If specified, only affect this color within the image

threshold System.Single

If specified, only match the color within this threshold, 0 is exact, 1 will match anything

RendererExt.ApplyCustomShader(this Renderer, CustomShader, Action) Method

Applies a custom Mod Helper shader, creating a new Texture with its effects baked in

public static void ApplyCustomShader(this Renderer renderer, BTD_Mod_Helper.Api.Enums.CustomShader customShader, System.Action<Material> modifyMaterial=null);

Parameters

renderer UnityEngine.Renderer

customShader CustomShader

Mod Helper custom shader

modifyMaterial System.Action<UnityEngine.Material>

changes to make to the material

RendererExt.ApplyOutlineShader(this Renderer) Method

Gives this renderer the default outline for towers, also making them glow white when selected

public static void ApplyOutlineShader(this Renderer renderer);

Parameters

renderer UnityEngine.Renderer

RendererExt.BakedMesh(this SkinnedMeshRenderer) Method

public static Mesh BakedMesh(this SkinnedMeshRenderer skinnedMeshRenderer);

Parameters

skinnedMeshRenderer UnityEngine.SkinnedMeshRenderer

Returns

UnityEngine.Mesh

RendererExt.GetBoneIndex(this SkinnedMeshRenderer, string) Method

public static int GetBoneIndex(this SkinnedMeshRenderer skinnedMeshRenderer, string name);

Parameters

skinnedMeshRenderer UnityEngine.SkinnedMeshRenderer

name System.String

Returns

System.Int32

RendererExt.GetTriangles(this SkinnedMeshRenderer, int) Method

Gets the list of triangles for a Mesh, even if its not marked as isReadable


Each "triangle" is a set of 3 consecutive ints in the list, where the number is the index in the vertices

public static System.Collections.Generic.List<int> GetTriangles(this SkinnedMeshRenderer skinnedMeshRenderer, int submesh=0);

Parameters

skinnedMeshRenderer UnityEngine.SkinnedMeshRenderer

submesh System.Int32

Returns

System.Collections.Generic.List<System.Int32>

RendererExt.GetTrianglesAsArrays(this SkinnedMeshRenderer, int) Method

public static System.Collections.Generic.List<int[]> GetTrianglesAsArrays(this SkinnedMeshRenderer skinnedMeshRenderer, int submesh=0);

Parameters

skinnedMeshRenderer UnityEngine.SkinnedMeshRenderer

submesh System.Int32

Returns

System.Collections.Generic.List<System.Int32[]>

RendererExt.GetVertices(this SkinnedMeshRenderer) Method

public static System.Collections.Generic.List<Vector3> GetVertices(this SkinnedMeshRenderer skinnedMeshRenderer);

Parameters

skinnedMeshRenderer UnityEngine.SkinnedMeshRenderer

Returns

System.Collections.Generic.List<UnityEngine.Vector3>

RendererExt.ReplaceColor(this Renderer, Color, Color, float) Method

Replaces all the usage of a target color (within a certain threshold) with a replacement color

public static void ReplaceColor(this Renderer renderer, Color targetColor, Color replacementColor, float threshold=0.05f);

Parameters

renderer UnityEngine.Renderer

targetColor UnityEngine.Color

The color to find

replacementColor UnityEngine.Color

The new color

threshold System.Single

The threshold for matching the target color, 0 is exact, 1 will match anything

RendererExt.SetMainTexture(this Il2CppReferenceArray, Texture2D) Method

Set the texture for all renderers in this collection. Equivalent to a "ForEach(render.material.mainTexture =
texture2D)"

public static void SetMainTexture(this Il2CppReferenceArray<Renderer> renderers, Texture2D texture2D);

Parameters

renderers Il2CppInterop.Runtime.InteropTypes.Arrays.Il2CppReferenceArray

texture2D UnityEngine.Texture2D

RendererExt.SetMainTexture(this Renderer, Texture2D) Method

Set the texture for this renderer. Equivalent to "render.material.mainTexture = texture2D"

public static void SetMainTexture(this Renderer renderer, Texture2D texture2D);

Parameters

renderer UnityEngine.Renderer

texture2D UnityEngine.Texture2D

RendererExt.SetOutlineColor(this Renderer, Color) Method

Sets the outline color for this renderer

public static void SetOutlineColor(this Renderer renderer, Color color);

Parameters

renderer UnityEngine.Renderer

color UnityEngine.Color

RendererExt.UnbindMesh(this SkinnedMeshRenderer) Method

Unbinds the renderer's sharedMesh, so that changes you make to it don't change the original

public static Mesh UnbindMesh(this SkinnedMeshRenderer skinnedMeshRenderer);

Parameters

skinnedMeshRenderer UnityEngine.SkinnedMeshRenderer

Returns

UnityEngine.Mesh

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