diff --git a/CHANGELOG.md b/CHANGELOG.md index 3943ae5f..f54307cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,8 +32,10 @@ Making a new release? Simply add the new header with the version and date undern ## Unreleased * LocalizationTables no longer report as changed when nothing changes. [(#1333)] +* Fixed the plugin preloading its notification sound as an image, which printed "Asset type does not match requested type" in Studio. ([#1344]) [#1333]: https://github.com/rojo-rbx/rojo/pull/1333 +[#1344]: https://github.com/rojo-rbx/rojo/pull/1344 ## [7.7.1] (October 1st, 2026) diff --git a/plugin/src/preloadAssets.lua b/plugin/src/preloadAssets.lua index 47c6d40b..d7501e42 100644 --- a/plugin/src/preloadAssets.lua +++ b/plugin/src/preloadAssets.lua @@ -21,12 +21,38 @@ function gatherAssetUrlsRecursive(currentTable, currentUrls) end local function preloadAssets() - local contentUrls = gatherAssetUrlsRecursive(Assets) + local contentUrls = {} + local soundUrls = {} + + for key, value in Assets do + if key == "Sounds" then + gatherAssetUrlsRecursive(value, soundUrls) + elseif typeof(value) == "string" then + table.insert(contentUrls, value) + elseif typeof(value) == "table" then + gatherAssetUrlsRecursive(value, contentUrls) + end + end Log.trace("Preloading assets: {:?}", contentUrls) + Log.trace("Preloading sounds: {:?}", soundUrls) + + -- PreloadAsync fetches a bare string as an image, so sounds go in as Sound + -- instances, which load their SoundId as audio. + local preloadList = table.clone(contentUrls) + local sounds = {} + for _, soundId in soundUrls do + local sound = Instance.new("Sound") + sound.SoundId = soundId + table.insert(sounds, sound) + table.insert(preloadList, sound) + end coroutine.wrap(function() - ContentProvider:PreloadAsync(contentUrls) + ContentProvider:PreloadAsync(preloadList) + for _, sound in sounds do + sound:Destroy() + end end)() end