I need help, i'am trying to add float number from a script to another script but it does not work. I'am new to c# and coding in general if somebody code fix the script and explained whats wrong with this i would be very thankful. This is the error i am getting. "NullReferenceException: Object reference not set to an instance of an object Resources.Die () (at Assets/Resources.cs:42) Resources.Update () (at Assets/Resources.cs:22)" Here is my scripts: 1st
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Resources : MonoBehaviour {
    public float maxHealth = 5;
    public float currentHealth;
    public float ResourceCounter;
    public Texture stoneIcon;
    public Texture woodIcon;
    void Start ()
    {
        currentHealth = maxHealth;
        ResourceCounter = 0;
    }
    void Update ()
    {
        Die();
    }
    public void OnMouseOver()
    {
        if(Input.GetButtonDown("Fire1"))
        {
            Debug.Log("Loosing one health");
            currentHealth = currentHealth - 1f;
        }
    }
    public void Die()
    {
        if(currentHealth <= 0)
        {
            Destroy(gameObject);
            Inventory inventory = GetComponent<Inventory>();
            inventory.ResourceStone = inventory.ResourceStone + 1;
        }
    }
}
2nd
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Inventory : MonoBehaviour {
    public float ResourceStone;
    // Use this for initialization
    void Start ()
    {
        ResourceStone = 0;
}
    // Update is called once per frame
    void Update () {
    }
}
