コード例 #1
0
    private void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }

        instance = this;
    }
コード例 #2
0
    private void Start()
    {
        transferUI = gameObject.GetComponentInChildrenWithTag <UITransfer>("UI");
        if (transferUI == null)
        {
            Debug.LogWarning("No TransferUI found !");
        }

        if (items != null && Items.Length == 0) // don't fill with debug items if data already loaded
        {
            foreach (var i in items)
            {
                AddItem((GameObject.Instantiate(i, Vector3.zero, Quaternion.identity) as GameObject).GetComponent <IItem>());
            }
        }

        if (shouldRegister)
        {
            ContainersManager.RegisterContainer(this);
        }
    }
コード例 #3
0
 private void OnDestroy()
 {
     instance = null;
 }