本文整理汇总了C#中Material.SetColor方法的典型用法代码示例。如果您正苦于以下问题:C# Material.SetColor方法的具体用法?C# Material.SetColor怎么用?C# Material.SetColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Material
的用法示例。
在下文中一共展示了Material.SetColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupFootprintPrefab
private static void SetupFootprintPrefab()
{
footprintPrefab = new GameObject ("KerbalEVAFootprint");
footprintPrefab.layer = GameLayers.LocalSpace;
footprintPrefab.SetActive (false);
var mf = footprintPrefab.AddComponent<MeshFilter> ();
var mr = footprintPrefab.AddComponent<MeshRenderer> ();
mf.mesh = new Quad (0.15f, 0.3f, true);
var material = new Material (Shaders.Footprint);
var footprintMask = new Texture2D (4, 4);
footprintMask.LoadImage (Textures.KerbalEVAFootprintMask);
material.SetTexture ("_MainTex", footprintMask);
material.SetFloat ("_Opacity", 0.8f);
material.SetColor ("_Color", Color.black);
mr.material = material;
mr.castShadows = false;
footprintPrefab.AddComponent<KerbalEVAFootprint> ();
Utils.Log ("Footprint prefab created");
}
示例2: RenderNow
public override void RenderNow()
{
if (m_context == null || !m_visible)
return;
Material material =
new Material(m_material == null ? m_context.material : m_material);
material.color = m_colorMult;
if (m_context.factory.useAdditionalColor)
material.SetColor("_AdditionalColor", m_colorAdd);
material.SetPass(0);
Graphics.DrawMeshNow(m_context.mesh, m_renderMatrix);
if (!Application.isEditor)
Material.Destroy(material);
}