Пример #1
0
        void SetAssetNameToAsset(string rootDirPath, string argAssetPath)
        {
            string assetPath = argAssetPath.Replace('\\', '/');

            string extension = Path.GetExtension(assetPath);

            if (ExtensionsToIgnore.Contains(extension))
            {
                return;
            }

            bool   isInResources   = false;
            string assetBundleName = GetAssetName(rootDirPath, assetPath, out isInResources);

            AssetImporter importer = AssetImporter.GetAtPath(assetPath);

            if (importer == null)
            {
                Debug.LogError("cannot get asset importer: " + assetPath);
                return;
            }

            importer.assetBundleName =
                hookAction != null?
                hookAction.Invoke(rootDirPath, assetBundleName, isInResources, importer) :
                    assetBundleName;

            importer.assetBundleVariant = "";
        }