I have this code first file
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Controller : MonoBehaviour
{
public Machines machines;
void Start()
{
machines = new Machines();
machines.ClickSpeedUpgrade();//here I get the error
}
}
second file
using System.Collections;
using System.Collections.Generic;
using BreakInfinity;
public class Machines
{
public void ClickSpeedUpgrade()
{
//some code
}
}
NullReferenceException: Object reference not set to an instance of an object
Why do I get this error and how can I fix it?