//SceneScript
using UnityEngine;
using System.Collections;
public class SceneScript : MonoBehaviour {
public GameObject Player;
public GameObject camera;
// Use this for initialization
void Start () {
camera = this.gameObject;
}
// Update is called once per frame
void Update () {
}
void LateUpdate()
{
if (Player != null) {
camera.transform.LookAt(Player.transform.position);
}
}
}
//test
using UnityEngine;
using System.Collections;
public class test : MonoBehaviour {
public int walkspeed;
// Use this for initialization
void Start () {
GameObject.Find("Main Camera").GetComponent<SceneScript> ().Player = this.gameObject;
}
// Update is called once per frame
void Update () {
forward ();
}
void forward ()
{
transform.position = transform.position + walkspeed * transform.forward*Time.deltaTime;
return;
throw new System.NotImplementedException ();
}
}