Add() public méthode

Adds a UI button.
public Add ( UIType type, GameObject obj, string fileName, Sprite spr = null ) : UIObject
type UIType
obj UnityEngine.GameObject Parent game object.
fileName string Resource file name with path, relative to Rersources folder.
spr UnityEngine.Sprite
Résultat UIObject
        /// <summary>
        /// Awake this instance.
        /// </summary>
        void Awake()
        {
            Debug.Log("<color=cyan>"+gameObject.name+"</color> AWAKEN");

            if (bgScreen == null) Debug.LogError("No bgScreen assigned to:"+gameObject.name);
            if (btnBye == null) Debug.LogError("No btnBye assigned to:"+gameObject.name);
            //use static creation for now
            uiManager = UIManager.Instance;
            //uiManager.AddButton(btnBye, "Sprites/btnBye", nextScreen, null, null);
            UIButton b = (UIButton)uiManager.Add(UIType.Button, btnBye, "Sprites/btnBye");
            b.Register(UIEvent.Click, nextScreen);
        }
        /// <summary>
        /// Awake this instance.
        /// </summary>
        void Awake()
        {
            Debug.Log("<color=cyan>"+gameObject.name+"</color> AWAKEN");

            //get managers
            uiManager = UIManager.Instance;
            gpm = GameManager.Instance;

            //TODO dynamic creation from file
            //uiManager.CreateFromFile("Config/screen");
            if (btnMir == null) Debug.LogError("No <color=cyan>btnMir</color> assigned to:<color=cyan>"+gameObject.name+"</color>");
            if (bgScreen == null) Debug.LogError("No <color=cyan>bgScreen</color> assigned to:<color=cyan>"+gameObject.name+"</color>");

            //use static creation for now
            //uiManager.AddButton(btnMir, "Sprites/btn_erzaehls_mir", nextScreen, null /*testOnRelease*/, null /*testOnOver*/);
            UIButton button = (UIButton)uiManager.Add(UIType.Button, btnMir, "Sprites/btn_erzaehls_mir");
            button.Register(UIEvent.Click, nextScreen);
        }