Bullet behavior
This is attached to the Bullet prefab, as follows:
using System.Collections;using System.Collections.Generic;using UnityEngine;public class BulletBehavior : MonoBehaviour { public float onscreenDelay = 5f; void Update () { Destroy(this.gameObject, onscreenDelay); }}
Camera behavior
This is attached to the Main Camera object, as follows:
using System.Collections;using System.Collections.Generic;using UnityEngine;public class CameraBehavior : MonoBehaviour { public Vector3 offset; private Transform playerPos; void Start() { playerPos = GameObject.Find("Player").transform; } void LateUpdate() { this.transform.position = playerPos.TransformPoint(offset); this.transform.LookAt(playerPos); }}