IEnumerator LoadUIPackage()
{
string url = Application.streamingAssetsPath.Replace("\\", "/") + "/FairyGUI-Examples/bundleusage.ab";
if (Application.platform != RuntimePlatform.Android)
url = "file:///" + url;
WWW www = new WWW(url);
yield return www;
if (string.IsNullOrEmpty(www.error))
{
AssetBundle bundle = www.assetBundle;
if (bundle == null)
{
Debug.LogWarning("Run Window->Build FairyGUI example Bundles first.");
yield return 0;
}
UIPackage.AddPackage(bundle);
_mainView = UIPackage.CreateObject("BundleUsage", "Main").asCom;
_mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
_mainView.AddRelation(GRoot.inst, RelationType.Size);
GRoot.inst.AddChild(_mainView);
_mainView.GetTransition("t0").Play();
}
else
Debug.LogError(www.error);
}