Renderer Material#
Mesh / Renderer / Renderer Material
Can Read
Can Write
Description#
The Material property of the Renderer component
Code#
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Set]
[Title("Renderer Material")]
[Category("Mesh/Renderer/Material")]
[Description("The Material property of the Renderer component")]
[Image(typeof(IconMesh), ColorTheme.Type.Blue)]
[Serializable]
public class GenTypeMaterial_Renderer_Material : TypeMaterial
{
[SerializeField] private GetGameObject m_Renderer = new GetGameObject(
new GenTypeGameObject_Renderer()
);
public override Material GetPreview(GameObject source)
{
GameObject instance = this.m_Renderer.GetPreview(source);
if (instance == null) return default;
Renderer component = instance.GetComponent<Renderer>();
return component != null ? component.material : default;
}
public override Material Get(Args args)
{
Renderer instance = this.m_Renderer.Get<Renderer>(args);
return instance != null
? instance.material
: default;
}
public override void Set(Material value, Args args)
{
Renderer component = this.m_Renderer.Get<Renderer>(args);
if (component != null) component.material = (Material) value;
}
public override string ToString()
{
return $"{this.m_Renderer} Material";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}