public void FireProjectile(Vector2 dirNormal) { GameObject portaleffectPrefab = Resources.Load("Portaleffect") as GameObject; GameObject Portaleffect = Instantiate(portaleffectPrefab); Vector3 playerPos = _fireposition.transform.position; projectile proj = Portaleffect.GetComponent <projectile>(); proj.Init(dirNormal); ParticleSystem ps = Portaleffect.GetComponent <ParticleSystem>(); //float offset_x = 0.0f; //float offset_y = 0.0f; float offset_z = 0.0f; if (_right) { //offset_x = 1.0f; // offset_y = 0.3f; offset_z = -1.0f; proj._flyForce += -1.0f; ps.startRotation = Mathf.Deg2Rad * -90.0f; } else { //offset_x = -1.0f; // offset_y = -0.3f; offset_z = 1.0f; proj._flyForce *= 1.0f; ps.startRotation = Mathf.Deg2Rad * 90.0f; } Portaleffect.transform.position = new Vector3(playerPos.x, playerPos.y, playerPos.z * offset_z); }