Iuvo Unity 0.5.1
This is library containing a variety of helper classes and extension methods for the Unity gane engine.
GitHub | Iuvo Unity Updates | Creator
Loading...
Searching...
No Matches
IuvoUnity.Extensions.RendererExtensions Class Reference

Provides extension methods for the Renderer component. More...

Static Public Member Functions

static void WithMaterial (this Renderer renderer, Material material)
 Sets the material of the renderer.
static void WithSharedMaterial (this Renderer renderer, Material material)
 Sets the shared material of the renderer.
static void WithMaterialAtIndex (this Renderer renderer, int index, Material material)
 Sets a material at a specific index in the renderer's material array.
static void Show (this Renderer renderer)
 Enables the renderer, making the object visible.
static void Hide (this Renderer renderer)
 Disables the renderer, making the object invisible.
static void WithSortingLayer (this Renderer renderer, string sortingLayer)
 Sets the sorting layer name of the renderer.
static void WithRenderQueue (this Renderer renderer, int queue)
 Sets the render queue of the renderer's material.
static void WithTransparency (this Renderer renderer, float alpha)
 Adjusts the alpha (transparency) value of the renderer's material color.
static void ResetTransparency (this Renderer renderer)
 Resets the renderer's material color alpha value to fully opaque.
static void WithGlow (this Renderer renderer, Color glowColor, float intensity)
 Sets the emission color and intensity for a glowing effect.
static void WithShader (this Renderer renderer, Shader shader)
 Assigns a new shader to the renderer's material.
static void ApplyTint (this Renderer renderer, Color color)
 Tints the renderer's material with a given color.

Detailed Description

Provides extension methods for the Renderer component.

Member Function Documentation

◆ ApplyTint()

void IuvoUnity.Extensions.RendererExtensions.ApplyTint ( this Renderer renderer,
Color color )
static

Tints the renderer's material with a given color.

Parameters
rendererThe renderer to modify.
colorThe tint color to apply.
136 {
137 renderer.material.SetColor("_Color", color);
138 }

◆ Hide()

void IuvoUnity.Extensions.RendererExtensions.Hide ( this Renderer renderer)
static

Disables the renderer, making the object invisible.

Parameters
rendererThe renderer to hide.
62 {
63 renderer.enabled = false;
64 }

◆ ResetTransparency()

void IuvoUnity.Extensions.RendererExtensions.ResetTransparency ( this Renderer renderer)
static

Resets the renderer's material color alpha value to fully opaque.

Parameters
rendererThe renderer to modify.
103 {
104 Color color = renderer.material.color;
105 color.a = 1f;
106 renderer.material.color = color;
107 }

◆ Show()

void IuvoUnity.Extensions.RendererExtensions.Show ( this Renderer renderer)
static

Enables the renderer, making the object visible.

Parameters
rendererThe renderer to show.
53 {
54 renderer.enabled = true;
55 }

◆ WithGlow()

void IuvoUnity.Extensions.RendererExtensions.WithGlow ( this Renderer renderer,
Color glowColor,
float intensity )
static

Sets the emission color and intensity for a glowing effect.

Parameters
rendererThe renderer to modify.
glowColorThe glow color to apply.
intensityThe intensity multiplier of the glow.
116 {
117 renderer.material.SetColor("_EmissionColor", glowColor * intensity);
118 }

◆ WithMaterial()

void IuvoUnity.Extensions.RendererExtensions.WithMaterial ( this Renderer renderer,
Material material )
static

Sets the material of the renderer.

Parameters
rendererThe renderer to modify.
materialThe material to assign.
18 {
19 renderer.material = material;
20 }

◆ WithMaterialAtIndex()

void IuvoUnity.Extensions.RendererExtensions.WithMaterialAtIndex ( this Renderer renderer,
int index,
Material material )
static

Sets a material at a specific index in the renderer's material array.

Parameters
rendererThe renderer to modify.
indexThe index of the material to replace.
materialThe new material to assign at the specified index.
39 {
40 Material[] materials = renderer.materials;
41 if (index >= 0 && index < materials.Length)
42 {
43 materials[index] = material;
44 renderer.materials = materials;
45 }
46 }

◆ WithRenderQueue()

void IuvoUnity.Extensions.RendererExtensions.WithRenderQueue ( this Renderer renderer,
int queue )
static

Sets the render queue of the renderer's material.

Parameters
rendererThe renderer to modify.
queueThe render queue value to set.
82 {
83 renderer.material.renderQueue = queue;
84 }

◆ WithShader()

void IuvoUnity.Extensions.RendererExtensions.WithShader ( this Renderer renderer,
Shader shader )
static

Assigns a new shader to the renderer's material.

Parameters
rendererThe renderer to modify.
shaderThe shader to assign.
126 {
127 renderer.material.shader = shader;
128 }

◆ WithSharedMaterial()

void IuvoUnity.Extensions.RendererExtensions.WithSharedMaterial ( this Renderer renderer,
Material material )
static

Sets the shared material of the renderer.

Parameters
rendererThe renderer to modify.
materialThe shared material to assign.
28 {
29 renderer.sharedMaterial = material;
30 }

◆ WithSortingLayer()

void IuvoUnity.Extensions.RendererExtensions.WithSortingLayer ( this Renderer renderer,
string sortingLayer )
static

Sets the sorting layer name of the renderer.

Parameters
rendererThe renderer to modify.
sortingLayerThe name of the sorting layer.
72 {
73 renderer.sortingLayerName = sortingLayer;
74 }

◆ WithTransparency()

void IuvoUnity.Extensions.RendererExtensions.WithTransparency ( this Renderer renderer,
float alpha )
static

Adjusts the alpha (transparency) value of the renderer's material color.

Parameters
rendererThe renderer to modify.
alphaThe alpha value to set (0 to 1).
92 {
93 Color color = renderer.material.color;
94 color.a = alpha;
95 renderer.material.color = color;
96 }

The documentation for this class was generated from the following file: