public static void createLighting(Vector3 pos, Transform enemyTarget) { GameObject lightingObj = Instantiate((GameObject)Resources.Load(lightingPrefabPath), pos, Quaternion.identity); Lighting lighting = lightingObj.GetComponent <Lighting>(); lighting.setObjectToTarget(enemyTarget, lightingSpeed); lighting.GetComponent <ParticleSystem>().Play(); }