How do i instantiate this class

NullReferenceException: Object reference not set to an instance of an object
Player.Start () (at Assets/MyScripts/Player.cs:11)

This is an error I get when trying to instantiate a non-monobehaviour class in a monobehaviour class. The non-mono class is Scar and the mono class is called Player.

void Start ()
	{
		setHealth (100);

		Scar scar = new Scar ();

		inventory.setSlotPrimary(scar, 0);//This is where the error occurs
	}

How do I instantiate my non-monobehaviour class in my monobehaviour class? I have already tried making my non-m class an m class and it doesn’t work.

Looks like somewhere before your “inventory.setSlotPrimary” you need to reference an inventory.

Something like:

Inventory inventory = gameObject.GetComponent<Inventory>();