public override void SetupObjective(GameObject objectiveManager) { masterSpriteRenderer = objectiveManager.GetComponentInChildren <SpriteRenderer>(); if (AISpawner == null) { AISpawner = Resources.Load("AISpawner") as GameObject; } GameObject spawner = (GameObject)GameObject.Instantiate(AISpawner, Position, Quaternion.identity); AISpawnerScript aiSpawnerScript = spawner.GetComponent <AISpawnerScript>(); aiSpawnerScript.startAI = GuardCount + 1; aiSpawnerScript.maxAI = GuardCount + 1; aiSpawnerScript.Init(); target = aiSpawnerScript.squadLeader; }