예제 #1
0
        private void SetAssetBundleForAssets(IEnumerable <Object> assets, string name, bool isVariant)
        {
            bool assetBundleNameChanged = false;

            foreach (Object obj in assets)
            {
                if (obj is MonoScript)
                {
                    continue;
                }

                AssetImporter importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(obj));
                if (importer == null)
                {
                    continue;
                }

                if (isVariant)
                {
                    importer.assetBundleVariant = name;
                }
                else
                {
                    importer.assetBundleName = name;
                }

                assetBundleNameChanged = true;
            }

            if (assetBundleNameChanged)
            {
                EditorApplication.Internal_CallAssetBundleNameChanged();
            }
        }
예제 #2
0
        private void SetAssetBundleForAssets(IEnumerable <UnityEngine.Object> assets, string name, bool isVariant)
        {
            bool flag = false;

            foreach (UnityEngine.Object current in assets)
            {
                if (!(current is MonoScript))
                {
                    AssetImporter atPath = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(current));
                    if (!(atPath == null))
                    {
                        if (isVariant)
                        {
                            atPath.assetBundleVariant = name;
                        }
                        else
                        {
                            atPath.assetBundleName = name;
                        }
                        flag = true;
                    }
                }
            }
            if (flag)
            {
                EditorApplication.Internal_CallAssetBundleNameChanged();
            }
        }