using UnityEngine;
using System.Collections;
public class Task : MonoBehaviour {
Ray ray;
RaycastHit _hit;
GameObject cube;
Material color1;
// Use this for initialization
void Start () {
//创建一个方块
cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
color1= GameObject.Find("Cube").GetComponent<MeshRenderer>().material;
}
// Update is called once per frame
void Update () {
//获取鼠标射线
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Unity通过射线快速变化物体颜色
最新推荐文章于 2024-05-27 20:27:58 发布