Example #1
0
    public static void BuildAloneSelectObject()
    {
        Object[] objs = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets);
        if (objs.Length == 0)
        {
            return;
        }

        InitState();

        List <BundleData> bundles = Objects2Bundles(objs);

        for (int i = 0; i < bundles.Count; i++)
        {
            if (BuildHelp.BuildRootBundle(bundles[i]))
            {
                DependsData.Add(CreateDependsData(bundles[i]));
            }
        }

        string dependsConfigPath = BuildHelp.GenerateOutputDependsPath();

        if (File.Exists(dependsConfigPath))
        {
            List <BundleDependsData> diskConfigData = BMDataAccessor.LoadObjectFromJsonFile <List <BundleDependsData> >(dependsConfigPath);
            for (int i = 0; i < DependsData.Count; i++)
            {
                InsertBundleData(DependsData[i], ref diskConfigData);
            }
            BMDataAccessor.SaveObjectToJsonFile <List <BundleDependsData> >(diskConfigData, dependsConfigPath);
        }
        else
        {
            BMDataAccessor.SaveObjectToJsonFile <List <BundleDependsData> >(DependsData, dependsConfigPath);
        }
    }