- Home /
Question by
z-red · Dec 09, 2017 at 09:19 PM ·
instantiatebuttonloadresources
Instantiate button prefab problem
Hi everybody. When i try instantiate button from prefab like this:
ButtonRadar = Instantiate (ButtonRadar, new Vector3 (60, -15, 0), Quaternion.identity);
ButtonRadar.transform.SetParent( GameObject.Find("Canvas").transform, false);
Button present on scene, but invisible. Buttons components Image(script) and button(script) is inactive(uncheck).
But if I make like this:
ButtonRadar = Instantiate((GameObject) Resources.Load("Prefab/pfRadarButton",typeof(GameObject)), new Vector3 (60, -15, 0), Quaternion.identity);
ButtonRadar = Instantiate (ButtonRadar, new Vector3 (60, -15, 0), Quaternion.identity);
I get normal result. The same prefab plased in Resources/Prefabs and Assets to.
(sorry my English)
Comment