单一改变某个物体(代码挂载到此物体上)颜色的代码如下:
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()
{
}
}