private void Play() { GameObject prefab = Instantiate(SkillPrefab, SpawnPoint.position, SpawnPoint.rotation, gameObject.transform); PlayerSkill playerskill = prefab.GetComponent <PlayerSkill>(); playerskill.Controller = this; if (playerskill.CanPlay()) { playerskill.Play(); Fire(); } else { Destroy(prefab); } }