예제 #1
0
    public bool CreateGameObjectAsync(string fileName, float delayDestroyTime, Action <float, bool, GameObject> onProcess)
    {
        bool ret = CreatePrefabAsync(fileName,
                                     delegate(float process, bool isDone, GameObject instObj){
            if (isDone)
            {
                if (instObj != null)
                {
                    ResInstDelayDestroy script = instObj.AddComponent <ResInstDelayDestroy>();
                    script.DelayDestroyTime    = delayDestroyTime;
                }
                if (onProcess != null)
                {
                    onProcess(process, isDone, instObj);
                }
                return;
            }

            if (onProcess != null)
            {
                onProcess(process, isDone, instObj);
            }
        }
                                     );

        return(ret);
    }
예제 #2
0
    public GameObject CreateGameObject(string fileName, float delayDestroyTime)
    {
        GameObject ret = CreatePrefab(fileName);

        if (ret != null)
        {
            ResInstDelayDestroy script = ret.AddComponent <ResInstDelayDestroy>();
            script.DelayDestroyTime = delayDestroyTime;
        }

        return(ret);
    }