Exemplo n.º 1
0
    IEnumerator Start()
    {
        DirectoryInfo dir = new DirectoryInfo(Path.Combine(Application.streamingAssetsPath, "models"));

        FileInfo[] info = dir.GetFiles("*.*");
        foreach (FileInfo f in info)
        {
            AssetBundleCreateRequest bundleRequest = AssetBundle.LoadFromFileAsync(Path.Combine(Application.streamingAssetsPath, "models/" + f.Name));
            yield return(bundleRequest);

            AssetBundle tempBundle = bundleRequest.assetBundle;
            //AssetBundle tempBundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "models/" + f.Name));
            if (tempBundle)
            {
                //Debug.Log(tempBundle);
                Object          tempObject = tempBundle.LoadAsset("ModelContainer");
                CustomModelInfo cm         = (tempObject as GameObject).GetComponent <CustomModelInfo>();
                if (cm != null)
                {
                    customModels.Add(cm.customModelInformation);
                    if (!customContentMenu)
                    {
                        customContentMenu = FindObjectOfType(typeof(CustomContentMenuManager)) as CustomContentMenuManager;
                    }
                    if (customContentMenu)
                    {
                        customContentMenu.AddCustomModel(cm.customModelInformation);
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
 public void MainMenuLoaded()
 {
     if (!customContentMenu)
     {
         customContentMenu = FindObjectOfType(typeof(CustomContentMenuManager)) as CustomContentMenuManager;
     }
     foreach (CustomModel cm in customModels)
     {
         customContentMenu.AddCustomModel(cm);
         //customContentMenu.UpdateListing(customContentMenu.dropdown.GetCurrentDoruType());
     }
 }