I want to run a video in the middle of the game, and this is not possible at the moment and i don’t have time to wait for 4.5 to be able to do so, so i’v made a blueprint that takes an array of images ( video converted to image sequence ) and each 0.04 sec ( 25fps ) the blueprint replaces the texture with the next one in the array. I know this is slow but this is what i can do for now, because i also need to fade it in and out and as a material it gives me the ability to do so.
Anyways, to add the image sequence one by one to the array ( dragging from the content browser ) is really annoying, i did so for a video of 281 frames length, but this is was only a test, the target video gonna be longer, so i wanna know how i can assign images to an array with the right order by name, now i don’t know where to start with c++, I really need a head start.
You could load all assets within a given folder by name. The names of each frame could be then using the movie name a prefix within a folder that has the same name as your movie name:
- MyMovie/
-
- MyMovie_1
-
- MyMovie_2
-
- MyMovie_3
-
- …
-
- MyMovie_N
To load each texture for example just use:
FStreamableManager& StreamableManager = UMyGameSingleton::Get().GetStreamableManager();
for (int i = 0; i < NumFrames; i++)
{
UObject* Texture = StreamableManager.SynchronousLoad("/Game/Textures/Movies" / MovieName / MovieName + "_" + i )
// Save texture in an array or whatever :D
}
Note: I used the ‘/’ character for string path concatenation, it will include the right path separator automatically.
Make sure to add a FStreamableManager member into your GameSingletonClass. For more info about the game singleton class check Ramas tutorial on persistent instances: A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums
Cheers,
Moss
Thanks Moss, i will give it a try.