private void Start() { myEnemyLife = GetComponent <EnemyLife>(); if (myEnemyLife != null) { myEnemyLife.SetEnemy(this); } myMovingBackAndForth = GetComponent <MovingBackAndForth>(); myMovingBackAndForth.SetEnemy(this); myEnemyHitBox = GetComponentInChildren <EnemyHitBox>(); if (myEnemyHitBox != null) { myEnemyHitBox.SetEnemy(this); } }