Provides extension methods for the Renderer component.
More...
|
| 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.
|
Provides extension methods for the Renderer component.
◆ ApplyTint()
| void IuvoUnity.Extensions.RendererExtensions.ApplyTint |
( |
this Renderer | renderer, |
|
|
Color | color ) |
|
static |
Tints the renderer's material with a given color.
- Parameters
-
| renderer | The renderer to modify. |
| color | The 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
-
| renderer | The 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
-
| renderer | The 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
-
| renderer | The 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
-
| renderer | The renderer to modify. |
| glowColor | The glow color to apply. |
| intensity | The 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
-
| renderer | The renderer to modify. |
| material | The 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
-
| renderer | The renderer to modify. |
| index | The index of the material to replace. |
| material | The 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
-
| renderer | The renderer to modify. |
| queue | The 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
-
| renderer | The renderer to modify. |
| shader | The 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
-
| renderer | The renderer to modify. |
| material | The 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
-
| renderer | The renderer to modify. |
| sortingLayer | The 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
-
| renderer | The renderer to modify. |
| alpha | The 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: