public void ShowTextEffect(float damage) { var position = uiStatus.GetHPPosition(); string path = "Effect/TextEffect"; GameObject prefab = Resources.Load(path) as GameObject; GameObject go = Instantiate(prefab); go.transform.position = position; TextEffect effect = go.GetComponent <TextEffect>(); effect.ShowTextEffect(damage); }