Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        IEnumerator Load2(string name)
        {
            IProgressResult <float, GameObject> result = resources.LoadAssetAsync <GameObject>(name);

            while (!result.IsDone)
            {
                Debug.LogFormat("Progress:{0}%", result.Progress * 100);
                yield return(null);
            }

            try
            {
                if (result.Exception != null)
                {
                    throw result.Exception;
                }

                GameObject.Instantiate(result.Result);
            }
            catch (Exception e)
            {
                Debug.LogErrorFormat("Load failure.Error:{0}", e);
            }
        }