Question is as title of the thread, is there a way to play gif using UI Toolkit?
I want to show a simple tutorial gif inside a UI Toolkit based popup.
Thanks in advance
Question is as title of the thread, is there a way to play gif using UI Toolkit?
I want to show a simple tutorial gif inside a UI Toolkit based popup.
Thanks in advance
Not a gif but you could use the video player to render to a texture and display that.
But I want to do this with UI Toolkit elements, maybe IMGUI Container does it? possible?
You render to a texture and display the texture in a VisualElement using the background style.
Solved! Thanks for your answer karl. Step by step for anybody need this:
1- Create a Plane object on the scene
2- Attach VideoPlayer component to it.
3- Import the mp4 file (just drag and drop it anywhere in Assets folder)
4- Assign the mp4 file as the resorce of the VideoPlayer of the Plane object(the object you created at step 1)
5- Select Render Mode attribute as “Render Texture” on VideoPlayer component of the Plane.
6- Assign the render texture to the Target Texture of the VideoPlayer.
7- Go into uss file and set background like this:
background-image: url(‘project://database/Assets/Resources/tutorial.renderTexture’);
It worked for me!
Updated version of sayacienes answer.
How to play a video in UIToolKit.
.video-player{ background-image: url('project://database/Assets/UI Toolkit/Resources/RenderTextureVideo.renderTexture'); }