Hello,
I’m making a game in a browser that works with videos in folder StreamingAssets.
The problem is that the videos are loaded only at the time when they start working (they start playing), which leads to the freezing of the image during playback due to the slow internet.
Is there any way to load all the videos from StreamingAssets at the very beginning of the game?
You can’t work with things in the StreamingAssets folder as easily as with other assets.
Hi Bedipavel,
If you’re looking to load a lot of assets on Start it might be worth looking at Addressables if you haven’t already!
Addressables Manual Unity - Manual: Addressables
If you do want to use StreamingAssets though, you could apply a bit of a workaround for it. If all of the assets you want to load are contained in a few parent files, you could use something like this:
string[] fileNames = System.IO.Directory.GetDirectories(parentFolderPath);
for (int i = 0; i < fileNames.Length; i++)
{
// load StreamingAsset fileName[i];
// loadedAssetsList.Add(asset);
}
You could then iterate through all of the parent folders, and store all of the loaded assets into lists/arrays. You would also have to take into account a longer loading time if you wanted all of the assets loaded in before reaching the start screen of your game.
I hope this is able to help somewhat!