I have fllowed the instructions of another persons code but it did not work instead it makes my whole screen the colour of my background.
here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class camerafollow : MonoBehaviour
{
public GameObject player;
public float cameraHeight = 20.0f;
void Update()
{
Vector3 pos = player.transform.position;
pos.z += cameraHeight;
transform.position = pos;
}
},I have used a code from another question and it does not work the reasons being that when i press play the whole screen goes to the colour of the background.
here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class camerafollow : MonoBehaviour
{
public GameObject player;
public float cameraHeight = 20.0f;
void Update()
{
Vector3 pos = player.transform.position;
pos.z += cameraHeight;
transform.position = pos;
}
}