2021-07-26【unity】hdrp下创建材质球赋值颜色
作者:
持刀的要迟到了 | 来源:发表于
2021-07-26 18:52 被阅读0次 public GameObject tileObj;
private Material mat = new Material(Shader.Find("HDRP/Unlit"));
private MaterialPropertyBlock block;
private MeshRenderer mesh;
public void Refresh(Vec pos)
{
if (tileObj == null)
{
tileObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
mesh = tileObj.GetComponent<MeshRenderer>();
mesh.material = mat;
block = new MaterialPropertyBlock();
}
block.SetColor("_UnlitColor", type.appearance.color);
mesh.SetPropertyBlock(block);
tileObj.transform.position = new Vector3(pos.x, 0, pos.y);
}
本文标题:2021-07-26【unity】hdrp下创建材质球赋值颜色
本文链接:https://www.haomeiwen.com/subject/cvpgmltx.html
网友评论