Quantcast
Channel: Questions in topic: "parenting"
Viewing all articles
Browse latest Browse all 302

Unable to Parent to a canvas

$
0
0
Im simply trying to parent a prefab to a canvas, there no problem instantiating the object only when i parent via "SETPARENT" it breaks the scene; when i drag it in runtime to the canvas theres also no problem. Any ideas? (The script is in the canvas object, the canvas is drag and set in the editor, i also try using gameobject but still wont work). public static bool fightSwitch; public GameObject party; public Canvas canvas; // Use this for initialization void Start () { fightSwitch = false; } // Update is called once per frame void Update () { if (fightSwitch == true) { GetComponentInChildren().SetBool("Intro", true); fightSwitch = false; party = Resources.Load ("OBJECTS/PARTY") as GameObject; Instantiate (party, transform.position, transform.rotation); party.transform.SetParent (canvas.transform,false);

Viewing all articles
Browse latest Browse all 302

Trending Articles



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