——————————
Unity入门实验
- 创建项目;
- 点击Hierarchy界面的Creat,添加Cube、Cylinder、Plane;
- 在Inspector界面Transform调整Cube、Cylinder、Plane和Directional Light的位置坐标、光线朝向等;
- 改变Cube颜色:点击Project界面的Create,添加C# Script,改名CubeColor,双击打开,代码如下:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CubeColor : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
this.GetComponent<Renderer>().material.color = Color.blue;
}
// Update is called once per frame
void Update()
{
this.GetComponent<Renderer>().material.