using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
void Start () {
}
// Update is called once per frame
void Update () {
transform.LookAt(a);
}
}
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
public Transform a; //创建一个物体。面板可以设置。就是放这个代码的要注视的物体a,把另一个物体在 面板上拖进就行了。
//此处不能写GameObject a,下面出错
// Use this for initializationvoid Start () {
}
// Update is called once per frame
void Update () {
transform.LookAt(a);
}
}