UnityEssentials
Small but useful tools and features for Unity
MeshRendererExtensions.cs
Go to the documentation of this file.
1 namespace UnityEngine
2 {
3  public static class MeshRendererExtensions
4  {
12  public static Material materialOfObject(this MeshRenderer meshRenderer)
13  {
14  return meshRenderer.material;
15  }
16 
24  public static Material[] materialsOfObject(this MeshRenderer meshRenderer)
25  {
26  return meshRenderer.materials;
27  }
28 
36  public static Material materialAsset(this MeshRenderer meshRenderer)
37  {
38  return meshRenderer.sharedMaterial;
39  }
40 
48  public static Material[] materialsAsset(this MeshRenderer meshRenderer)
49  {
50  return meshRenderer.sharedMaterials;
51  }
52 
53  }
54 }
55 
static Material[] materialsOfObject(this MeshRenderer meshRenderer)
Returns all the instantiated materials of this object.
static Material[] materialsAsset(this MeshRenderer meshRenderer)
The shared materials of this object.
static Material materialOfObject(this MeshRenderer meshRenderer)
Returns the first instantiated Material assigned to the renderer.
static Material materialAsset(this MeshRenderer meshRenderer)
The shared material of this object.