Table of Contents
Extensions for unity renderers
public static class RendererExt
Inheritance System.Object RendererExt
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);
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
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);
renderer
UnityEngine.Renderer
customShader
CustomShader
Mod Helper custom shader
modifyMaterial
System.Action<UnityEngine.Material>
changes to make to the material
Gives this renderer the default outline for towers, also making them glow white when selected
public static void ApplyOutlineShader(this Renderer renderer);
renderer
UnityEngine.Renderer
public static Mesh BakedMesh(this SkinnedMeshRenderer skinnedMeshRenderer);
skinnedMeshRenderer
UnityEngine.SkinnedMeshRenderer
public static int GetBoneIndex(this SkinnedMeshRenderer skinnedMeshRenderer, string name);
skinnedMeshRenderer
UnityEngine.SkinnedMeshRenderer
name
System.String
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);
skinnedMeshRenderer
UnityEngine.SkinnedMeshRenderer
submesh
System.Int32
System.Collections.Generic.List<System.Int32>
public static System.Collections.Generic.List<int[]> GetTrianglesAsArrays(this SkinnedMeshRenderer skinnedMeshRenderer, int submesh=0);
skinnedMeshRenderer
UnityEngine.SkinnedMeshRenderer
submesh
System.Int32
System.Collections.Generic.List<System.Int32[]>
public static System.Collections.Generic.List<Vector3> GetVertices(this SkinnedMeshRenderer skinnedMeshRenderer);
skinnedMeshRenderer
UnityEngine.SkinnedMeshRenderer
System.Collections.Generic.List<UnityEngine.Vector3>
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);
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
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);
renderers
Il2CppInterop.Runtime.InteropTypes.Arrays.Il2CppReferenceArray
texture2D
UnityEngine.Texture2D
Set the texture for this renderer. Equivalent to "render.material.mainTexture = texture2D"
public static void SetMainTexture(this Renderer renderer, Texture2D texture2D);
renderer
UnityEngine.Renderer
texture2D
UnityEngine.Texture2D
Sets the outline color for this renderer
public static void SetOutlineColor(this Renderer renderer, Color color);
renderer
UnityEngine.Renderer
color
UnityEngine.Color
Unbinds the renderer's sharedMesh, so that changes you make to it don't change the original
public static Mesh UnbindMesh(this SkinnedMeshRenderer skinnedMeshRenderer);
skinnedMeshRenderer
UnityEngine.SkinnedMeshRenderer