Hi!
I am making a simple player follow script and it is not working. When I checked what it is finding, it is finding "Player(Clone)". There is no clone in the scene or in the prefabs. Why is it doing this?
My code.
using UnityEngine;
using System.Collections;
public class CameraFollow : MonoBehaviour {
public GameObject target;
void Start(){
target = GameObject.FindGameObjectWithTag("Player");
}
void Update(){
transform.position = new Vector3(target.transform.position.x, target.transform.position.y, -10);
}
}
↧