コード例 #1
0
        public void OnEnable(Rect pos, EditorWindow parent)
        {
            //LoadData...
            var dataPath = System.IO.Path.GetFullPath(".");

            dataPath  = dataPath.Replace("\\", "/");
            dataPath += "/Library/AssetBundleBrowserBuild.dat";

            if (File.Exists(dataPath))
            {
                BinaryFormatter bf   = new BinaryFormatter();
                FileStream      file = File.Open(dataPath, FileMode.Open);
                var             data = bf.Deserialize(file) as BuildTabData;
                if (data != null)
                {
                    m_UserData = data;
                }
                file.Close();
            }

            m_ToggleData = new List <ToggleData>();
            m_ToggleData.Add(new ToggleData(
                                 false,
                                 "Exclude Type Information",
                                 "Do not include type information within the asset bundle (don't write type tree).",
                                 m_UserData.m_OnToggles,
                                 BuildAssetBundleOptions.DisableWriteTypeTree));
            m_ToggleData.Add(new ToggleData(
                                 false,
                                 "Force Rebuild",
                                 "Force rebuild the asset bundles",
                                 m_UserData.m_OnToggles,
                                 BuildAssetBundleOptions.ForceRebuildAssetBundle));
            m_ToggleData.Add(new ToggleData(
                                 false,
                                 "Ignore Type Tree Changes",
                                 "Ignore the type tree changes when doing the incremental build check.",
                                 m_UserData.m_OnToggles,
                                 BuildAssetBundleOptions.IgnoreTypeTreeChanges));
            m_ToggleData.Add(new ToggleData(
                                 false,
                                 "Append Hash",
                                 "Append the hash to the assetBundle name.",
                                 m_UserData.m_OnToggles,
                                 BuildAssetBundleOptions.AppendHashToAssetBundleName));
            m_ToggleData.Add(new ToggleData(
                                 false,
                                 "Strict Mode",
                                 "Do not allow the build to succeed if any errors are reporting during it.",
                                 m_UserData.m_OnToggles,
                                 BuildAssetBundleOptions.StrictMode));
            m_ToggleData.Add(new ToggleData(
                                 false,
                                 "Dry Run Build",
                                 "Do a dry run build.",
                                 m_UserData.m_OnToggles,
                                 BuildAssetBundleOptions.DryRunBuild));


            m_ForceRebuild = new ToggleData(
                false,
                "Clear Folders",
                "Will wipe out all contents of build directory as well as StreamingAssets/AssetBundles if you are choosing to copy build there.",
                m_UserData.m_OnToggles);
            m_CopyToStreaming = new ToggleData(
                false,
                "Copy to StreamingAssets",
                "After build completes, will copy all build content to " + m_streamingPath + " for use in stand-alone player.",
                m_UserData.m_OnToggles);

            m_TargetContent      = new GUIContent("Build Target", "Choose target platform to build for.");
            m_CompressionContent = new GUIContent("Compression", "Choose no compress, standard (LZMA), or chunk based (LZ4)");

            if (m_UserData.m_UseDefaultPath)
            {
                ResetPathToDefault();
            }
        }