我们先看一下效果吧
这个正方体可以转动
首先创建一个cube对象,然后将unity3d贴图置于Cube的材质
并编写一个名为Rotate.cs的脚本文件
using UnityEngine;
using System.Collections;
public class Rotate : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
gameObject.transform.Rotate (0,15*Time.deltaTime,0,Space.Self);//绕y轴旋转,按物体自身为中心
}
}
将Rotate.cs脚本文件拖至cube对象,这样cube就可以旋转了
最后再创建一个PointLight点光源拖至场景就实现了.