public void ablilityAnimationEvent() { if (abilityTarget == null) { abilityTarget = EnemyController.findClosestEnemy(this); if (abilityTarget == null) { return; } abilityTarget.onEnemyDeath += onTargetDead; } Debug.Log(abilityTarget.name + " " + name); beam = Instantiate(beamPrefab).GetComponent <BeamController>(); beam.beamToTarget(abilityTarget); beam.transform.SetParent(transform); beam.transform.localPosition = new Vector3(0, 10.3f, -1.9f); StartCoroutine(proceedAbility()); }