Example #1
0
 private void OnMouseUpAsButton()
 {
     if (GameObject.Find("PopupSchedule") != null || GameObject.Find("EventPopup") != null)
     {
         return;
     }
     PopupInventory.Instantiate().Init();
 }
    public static PopupInventory Instantiate()
    {
        GameObject obj = Instantiate(Resources.Load <GameObject>("Popup/PopupInventory"));

        if (obj == null || obj.GetComponent <PopupInventory>() == null)
        {
            Debug.LogError("<color=red> Resource Loading Error!! - PopupInventory </color>");
            return(null);
        }

        PopupInventory popup = obj.GetComponent <PopupInventory>();

        obj.transform.SetParent(m_canvas.transform);
        popup.GetComponent <RectTransform>().localPosition = Vector3.zero;
        popup.GetComponent <RectTransform>().localScale    = Vector3.one;
        popup.Init();

        return(popup);
    }