Created
April 12, 2016 11:20
-
-
Save tm8r/8d811f3c1f8e63ea8f4f267a9dc01459 to your computer and use it in GitHub Desktop.
instantiate uGUI prefab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class CanvasManager : MonoBehaviour | |
{ | |
GameObject buttonPrefab; | |
void Awake () | |
{ | |
buttonPrefab = Resources.Load<GameObject> ("ugui/Button"); | |
} | |
void Start () | |
{ | |
var instance = Instantiate (buttonPrefab); | |
instance.transform.SetParent (gameObject.transform, false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment