i am building a simulation that requires a search box in which the user can type in the name of a game object and the camera should automatically zoom in on this object in the Unity 5 scene. However i have tried multiple scripts with no luck.
The below code is what i thought would work to solve this, however it did not!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class drone_camera_lookup : MonoBehaviour {
    public float minX = -360.0f;
    public float maxX = 360.0f;
    public float minY = -45.0f;
    public float maxY = 45.0f;
    public float sensX = 100.0f;
    public float sensY = 100.0f;
    float rotationY = 0.0f;
    float rotationX = 0.0f;
    public GameObject drone;
    public GameObject actual;
    public GameObject instance;
    var gameObjectTag;
    void Update () {
          //  drone = Resources.Load("drone_with_controller") as GameObject;
            drone = GameObject.FindGameObjectWithTag(gameObjectTag);
            actual = this.drone.GetComponent<GameObject>();
            instance = Instantiate(actual, transform.position, transform.rotation) as GameObject;
            rotationX += instance.transform.localEulerAngles.x * sensX * Time.deltaTime;
            rotationY += instance.transform.localEulerAngles.y * sensY * Time.deltaTime;
            rotationY = Mathf.Clamp (rotationY, minY, maxY);
            transform.localEulerAngles = new Vector3 (-rotationY, rotationX, 0);    
    }
}
The error been show is : NullReferenceException: Object reference not set to an instance of an object
I would ideally like to make the script animate the camera to the object.Thank you in advance.
 
    