Exemplo n.º 1
0
        public void ExportAssetbundle(Object[] selectionGameObjects)
        {
            if (selectionGameObjects == null || selectionGameObjects.Length == 0)
            {
                return;
            }
            AssetDatabase.SaveAssets();

            foreach (var v in _BuildTargetMap)
            {
                foreach (Object obj in selectionGameObjects)
                {
                    if (obj is GameObject || obj is Texture2D)
                    {
                        AssetDatabase.Refresh();
                        string locationPathName = RootPath + "/" + v.Value + "/" + obj.name + ".assetbundle";
                        HS_Directory.CreateDirectory(HS_Path.GetDirectoryName(locationPathName));
                        BuildPipeline.BuildAssetBundle(obj, null, locationPathName, BuildAssetBundleOptions.CollectDependencies, v.Key);
                    }
                    else
                    {
                        D.LogForce(obj.name + " 不是预制体");
                    }
                }
            }
            this.OpenFolder();
            EditorUtility.DisplayDialog("提示", "打包完成", "确认");
        }
Exemplo n.º 2
0
        static public void BuildForWindows(HS_EditDefine.HS_ChannelDefine channelDefine)
        {
            LoadConfig();

            ChannelConfig channelConfig = S_AllChannelConfig[channelDefine.ToString()];
            //string channel = channelConfig.channel;
            string packerName = channelConfig.packerName;
            string rootPath   = S_RootPath;

            PlayerSettings.bundleIdentifier            = packerName;
            PlayerSettings.defaultInterfaceOrientation = UIOrientation.LandscapeLeft;
            string path = rootPath + "/Client/Windows";

            HS_Directory.CreateDirectory(path);

            try
            {
                HS_Base.SystemDeleteFolder(path);
            }
            catch (System.Exception _e)
            {
                D.LogForce("Ignore: " + _e.ToString());
            }

            string lastDefineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);

            if (!string.IsNullOrEmpty(channelConfig.defineSymbols))
            {
                PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, channelConfig.defineSymbols);
            }
            else
            {
                PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, "");
            }
            if (!string.IsNullOrEmpty(lastDefineSymbols))
            {
                PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, lastDefineSymbols);
            }

            path += "/" + packerName + ".exe";

            //FilterEditorDLL(FilterEditorDLLModel.Assets2Backups);
            //更新SVN并且拷贝到streamingAssets
            SVNUpdate(RuntimePlatform.WindowsPlayer);

            BuildPipeline.BuildPlayer(GetBuildScenes(), path, BuildTarget.StandaloneWindows64, BuildOptions.None);
            //FilterEditorDLL(FilterEditorDLLModel.Backups2Assets);
            RemoveSVNResources();
            AssetDatabase.Refresh();
            System.Diagnostics.Process.Start(HS_Path.GetDirectoryName(path));
        }