예제 #1
0
        static void SetEachInsideDirToOne()
        {
            UObj dir = Selection.activeObject;

            QueryWindow.Show("set what kind obj to one bundle", (ret) => {
                UObj[] os = Selection.GetFiltered(typeof(UObj), SelectionMode.DeepAssets);
                foreach (UObj selected in os)
                {
                    if (selected.GetType() == typeof(DefaultAsset))
                    {
                        continue;
                    }
                    string path = AssetDatabase.GetAssetPath(selected);
                    Debug.Log(path);
                    AssetImporter asset = AssetImporter.GetAtPath(path);
                    if (path.EndsWith(ret))
                    {
                        asset.assetBundleName = dir.name + ".assetbundle"; //设置Bundle文件的名称
                    }
                    else
                    {
                        asset.assetBundleName = null;
                    }
                }
                AssetDatabase.Refresh();
                Debug.Log("Set Done");
            });
        }
예제 #2
0
        public static void Show(string text, Action <string> cb)
        {
            QueryWindow window = ScriptableObject.CreateInstance <QueryWindow>();

            window.position = new Rect(300, 300, 250, 150);
            window.text     = text;
            window.callback = cb;
            window.ShowPopup();
        }