Unity Create UI control from script
You are supposed to make the Toggle the child of the Canvas. You didn’t do that in your code. Also, you move a UI component and GameObject with newGO.GetComponent<RectTransform>().anchoredPosition3D not newGO.transform.position. There are 3 Ways to create a Complete UI Control in Unity: 1.Use the DefaultControls API to generate it (Easy and Recommended) With the … Read more