PrefabPoolAgent.OnInit C# (CSharp) Method

OnInit() public method

public OnInit ( string tag, Component who ) : void
tag string
who Component
return void
    public void OnInit(string tag, Component who)
    {
        Global.AssetLoadManager.LoadAsset<GameObject>("prefab/" + tag, tag, (prefab) =>
        {
            GameObject go = GameObject.Instantiate(prefab) as GameObject;
            if (go == null) return;
            entity = go;
            entity.name = tag;
            pool = who as PrefabPool;

            //判断类型, 后期类型多了后,会改条件
            particle = entity.GetComponentInChildren<ParticleSystem>();

            Reset();

            if (callback != null) callback(this);
        });
    }