public void SpawnShield() { Dial dialCon = GameObject.Find("Dial").gameObject.GetComponent <Dial>(); if (dialCon.IsShielded(GetCurrentLaneID() - 1)) //if there's already a shield there { dialCon.DestroyShield(GetCurrentLaneID() - 1); //destroy that shield Debug.Log("destroyed previous shield"); } GameObject shield = Instantiate(Resources.Load("Prefabs/MainCanvas/Shield")) as GameObject; //make a shield shield.transform.SetParent(Dial.underLayer, false); Shield sc = shield.GetComponent <Shield>(); //make it the type of shield this thing deploys ConfigureShield(sc); //find your angle float shieldOwnangle = this.transform.eulerAngles.z; float shieldAngle = (shieldOwnangle + 90) % 360; shieldAngle *= (float)Math.PI / 180; //find where to spawn the shield RectTransform shieldRt = sc.GetComponent <RectTransform>(); shieldRt.anchoredPosition = new Vector2(shieldRange * Mathf.Cos(shieldAngle), shieldRange * Mathf.Sin(shieldAngle)); //Debug.Log("shield y should be " + shieldRange * Mathf.Sin(shieldAngle)); shieldRt.rotation = this.gameObject.transform.rotation; dialCon.PlaceShield(GetCurrentLaneID() - 1, shield); //mark current lane as shielded (placed in array) }