Quantcast
Channel: Questions in topic: "clone"
Viewing all articles
Browse latest Browse all 508

SetParent UI Text to Canvas [Instantiate]

$
0
0
Hi there, _Graham, please don't add the error code as a tag again. It didn't help the first time or the second time. I need some actual help with this._ I'm trying to clone a UI.Text with instantiate, but it places it outside of the canvas. I tried to use .SetParent to parent it to the canvas, but that didn't work. This is the error I keep getting: BCE0023: No appropriate version of 'UnityEngine.Transform.SetParent' for the argument list '(System.Type, boolean)' was found.* And this is my script: #pragma strict var NotificationText : Transform; function Update(){ if (Input.GetKeyDown("e")){ var NotificationTextClone = Instantiate(NotificationText); NotificationTextClone.transform.SetParent(Canvas,false); Destroy(NotificationTextClone.gameObject, 5); } }

Viewing all articles
Browse latest Browse all 508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>