public void Setup(AbstractText text) { //place this behind the text by 1cm. this.GetComponent <RectTransform>().position = text.GetWorldPosition() + text.Forward() * 0.001f; this.GetComponent <RectTransform>().rotation = text.GetQuaternion(); //synchronize text boxes... //cr.Synchronize(text); }
protected GameObject CreateBackground(GameObject textClone) { GameObject go = GameObject.Instantiate(toCloneBackground); go.SetActive(true); go.transform.SetParent(this.transform); AbstractText at = textClone.GetComponent <AbstractText>(); go.GetComponent <ImageBackground>().Setup(at); return(go); }
protected GameObject createTextClone() { GameObject go = GameObject.Instantiate(toClone); go.SetActive(true); go.transform.SetParent(this.transform); go.transform.localPosition = new Vector3(Random.value * 20f, Random.value * 5f, Random.value * 5f); if (go.transform.position != Vector3.zero) { go.transform.rotation = Quaternion.LookRotation(go.transform.position); } AbstractText at = go.GetComponent <AbstractText>(); at.SetText(RandomString()); at.SetColor(new Color(Random.value, Random.value, Random.value)); return(go); }