C# Object reference is not set to an instance of an object?

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Ammo_Pickup : MonoBehaviour {

public GameObject player;

void Start () 
	player = GameObject.Find ("Player");

void Update () {


public void OnTriggerEnter(Collider other)
	player.GetComponent<Shoot> ().ammo += 10;


The error is on line 23(The line under the OnTriggerEnter void), i’m trying to have it where when the Player enters the collider he gets ammo.

Exact Error: NullReferenceException: Object reference not set to an instance of an object
Ammo_Pickup.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/Ammo_Pickup.cs:23)

Either there isn’t any active game object called “Player”, or it doesn’t have a “Shoot” component.

Something is null on line 23. Either player or the result of GetComponent().

Lots of questions regarding this you can read answers for more details.

Check if your player object is actually called “Player” in the scene and also make sure that it has a shoot component assigned.