Esempio n. 1
0
    private void Awake()
    {
        if (IsDontdestroyonload)
        {
            DontDestroyOnLoad(this.gameObject);
        }

        //Check if there is already an instance of JObjectPool
        if (Instance == null)
        {
            Instance = this;
        }
        //If _InstanceJObjectPool already exists ,Destroy this
        //this enforces our singleton pattern so there can only be one instance of JObjectPool.
        else if (Instance != this)
        {
            Destroy(this.gameObject);
        }

        Init();
    }
Esempio n. 2
0
    private void Awake()
    {
        if (IsDontdestroyonload)
        {
            DontDestroyOnLoad(this.gameObject);
        }

        //Check if there is already an instance of JObjectPool
        if (_InstanceJObjectPool == null)
        {
            _InstanceJObjectPool = this;
        }
        //If _InstanceJObjectPool already exists ,Destroy this
        //this enforces our singleton pattern so there can only be one instance of JObjectPool.
        else if (_InstanceJObjectPool != this)
        {
            Destroy(this.gameObject);
        }

        m_Dictionary          = new Dictionary <string, List <GameObject> >();
        m_DictionaryForParent = new Dictionary <string, GameObject>();
        Init();
    }