public void SpawnChaser() { GameObject chaser = Instantiate(chaserObject, spawnPosition, Quaternion.identity) as GameObject; chaser.transform.parent = gameObject.transform.parent; ChaserMovement chaserMovement = chaser.GetComponent <ChaserMovement>(); if (chaserMovement == null) { return; } if (actionHistory == null) { Movement movement = gameObject.GetComponent <Movement>(); if (movement != null) { actionHistory = movement.actionHistory; } } //#! if (chaserMovement is MonkeyMovement) { (chaserMovement as MonkeyMovement).target = gameObject; } else { chaserMovement.targetActions = actionHistory.GetEnumaration(); } }