Skip to content

Commit

Permalink
Setting material to another asset bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
dalkia committed Mar 12, 2024
1 parent 1e9c44a commit cd3089d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public async void ConvertLODs()
Directory.CreateDirectory(tempPath);
string[] downloadedFiles = await DownloadFiles();
AssetDatabase.SaveAssets();

IAssetDatabase assetDatabase = new UnityEditorWrappers.AssetDatabase();

try
{
var dictionaryStringForMetadata = new Dictionary<string, string>();
Expand All @@ -50,6 +53,7 @@ public async void ConvertLODs()
BuildPrefab(PathUtils.GetRelativePathTo(Application.dataPath, newPath));
}

assetDatabase.AssignAssetBundle(Shader.Find("DCL/Scene"), false);
BuildAssetBundles(EditorUserBuildSettings.activeBuildTarget, dictionaryStringForMetadata);
}
catch (Exception e)
Expand Down Expand Up @@ -107,7 +111,7 @@ private void BuildPrefab(string fileToProcess)
Object.DestroyImmediate(instantiated);

var prefabImporter = AssetImporter.GetAtPath(filePath);
prefabImporter.SetAssetBundleNameAndVariant(fileNameWithoutExtension, "");
prefabImporter.SetAssetBundleNameAndVariant(fileNameWithoutExtension + PlatformUtils.GetPlatform(), "");
AssetDatabase.Refresh();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public URLFileDownloader(string[] lodsURL, string tempDownloadPath)

public async Task<string[]> Download()
{
Directory.CreateDirectory(tempDownloadPath);
string[] downloadedPaths = new string[lodsURL.Length];
for (int index = 0; index < lodsURL.Length; index++)
{
Expand Down

0 comments on commit cd3089d

Please sign in to comment.