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)