I'm trying to instantiate an Image as a child of a canvas element.
This code is attached to the Unity Canvas that i want to have as the parent.
Image Pokal = GameObject.Instantiate(Resources.Load("Pokal")) as Image;
if (Pokal != null)
Pokal.gameObject.GetComponent<RectTransform>().parent = gameObject.transform;
I want my "Pokal" to become a child of the UI Canvas element. How do i do this? The prefab is added to the scene but i can't figure out how to make it a child of the Canvas Element.