单一改变某个物体(代码挂载到此物体上)颜色的代码如下:

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

public class Spherecolor : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        GetComponent<Renderer>().material.color = new Color(0, 1, 0);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐