Implementation of 2D animation

Hi!

I’m working on my first game and must learn a lot. It’s 2D platformer and I chosed UE4-27 because simply there are more UE4 tutorials on yt :see_no_evil:
I have question (propably first of many other questions): how can I import 2D for example mp4 animation to my game as intro? I mean, i want it to be just opening scene (some kind of short movie) when player cannot do anything, just watch and get know something about plot. Is this possible? Which movie format is supported in UE?

Thank you!

#animation #animation-tools

Hi @Somnambulik1 ! Of course you can play videos in Unreal and yes Unreal prefers mp4 files.

Here is the recipe:

you will need a media player:

image

when you create it you will be prompted to create a media player output texture asset…mark it and create one too:

image

Of course you need an mp4 to play :slight_smile: put the mp4 in the contents folder of the project inside a folder called MOVIES (is important to be there and the folder to be named MOVIES)

also add a media source:

image

open media source and select your movie:


…save and close.

create a material:

image

define the material as USER INTERFACE:

image

main node will look like this:

image

add a texture sample and connect it to final color:

image

as texture select your media texture:

save the material and close

create a Widget blueprint

image

open the widget and drag and drop an image component:

image

select the image and choose this anchor type:

image

put all this values in 0:

image

your image should take the whole widget like this:

now put the material in the brush slot of the image:

image

save the widget and close

open the level blueprint

image

create a media player variable. press compile and then assign the media player you created:

image

image

image

now you must create an instance of your widget and put it in the screen. then use your media player variable to open the source media and play it.

play the project and enjoy the movie!

P.S.- Before you ask it: in windows you wont hear anything from the video. in this case you must have the audio as audio component and play at the same time.
in other platforms (like android), the audio of the mp4 file works fine

2 Likes