Hello,
I’d like to display an additional viewport in my game where user could preview given skill (animation). So I want it work just like preview animation thumbnail in editor. When user hovers a button a small window will appear with a looping animation in it.
I’ve got it working in editor by using custom viewport client class
class FMyViewportClient : public FCommonViewportClient, public FViewElementDrawer, public FGCObject
custom viewport widget class - STestViewport
and FPreviewScene
.
In editor I can display the viewport (draw it propely), add any component to preview scene (skeletal mesh component in this case) and draw these component in viewport.
In game (development build) I can also display viewport and add components but I can no longer visualize any of them. List of components in FPreviewScene
contains SkeletalMeshComponent so I know it’s there but it’s just not drawn.
So in FMyViewportClient
class in Draw
method I create a ViewFamily
with FEngineShowFlags(ESFIM_Editor)
(i tried ESFIM_Game
also but it doesnt work either).
So I want to ask, is there any limiatation of FPreviewScene
that makes it not render it’s world correctly in development builds? Or I’m just missing something? Maybe there is a specific set of flags that I need to set on SkelMesh? I know it’s hard to tell without looking into my setup but it’s quite a lot of code so I’m not going to post it right now.
And in general, is it a good idea to use this method to create anim preview feature in game?
Cheers