Here is the code:
foreach (GameObject go in Dependencies)
{
BossDependency dep = Instantiate(go, transform.position, transform.rotation).GetComponent<BossDependency>();
existingDependencies.Add(dep);
dep.BossObject = this;
}
The main issue is that it just throws an Object reference not set to an instance of an object error and stops the foreach loop. I tried using Debug.Log(dep) but it shows that it exists.