Unity改变物体颜色

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class Change_Color : MonoBehaviour {
    void Start() {
        GameObject Cube =  GameObject.CreatePrimitive(PrimitiveType.Cylinder);
        Cube.GetComponent<Renderer>().material.color = new Color(1,0,0);  // 重点是这一句
    }
    void Update() {

    }
}

参考:https://blog.csdn.net/weixin_44345862/article/details/122115404

你可能感兴趣的:(Unity,unity,游戏引擎)