// Since Enemy is never created as a gameobject, this is used instead of Unity's Start() protected void Start() { rb2d = GetComponent <Rigidbody2D>(); detect = GetComponent <EnemyDetection>(); wall = SpriteLibrary.library.Wall; if (textBox != null) { textBox = Instantiate(textBox, transform); textBox.transform.localPosition = Vector2.zero; Textbox box = textBox.GetComponent <Textbox>(); box.AddTitle(GetName()); foreach (GameObject backup in battleSpawn) { box.AddSub(backup.GetComponent <Enemy>().GetName()); } } }