Forum rules - please read before posting.

Menu as video player

I have been trying to get an AC menu using a Unity UI prefab to work as a video player, but although the text and button elements work, I can't seem to manage to get the menu to display the video element.

I tried using the Unity canvas I created in a stand-alone project and it works fine, but not when I link it to the AC menu.

In the canvas, I tried using both a Plane 3D object (without linking it to an AC menu element) and a Raw Image (tried having it without a link and with a link to a graphic element in the AC menu), but nothing works. The video does load (test before for video prepared using Playmaker) and does play (as I can hear the sound, as the Video Player component on the Plane/Raw Image is linked to a Sound Source component).

The canvas renders in Screen Space - Camera mode (as do the other canvases I created and linked to AC menus). For the game objects which carry the video player component, the settings are:

1) with Raw Image

Texture: Video renderer (Render Texture)
Material: Video renderer (Matierial)

2) with Plane

Materials, Element 0: Video renderer (Matierial)

Any insights into why this may not work?

Comments

  • As AC's elements are not designed to work with Video Players, I wouldn't advise connecting the UI component to AC.  Non-connected component should still be OK to place in AC-connected Canvases, however.

    The difference may be that a AC-connected UI prefab is spawned in at runtime, and enabled/disabled as and when needed.  You could try change the "Source" to Unity Ui In Scene, and having a local copy of the UI canvas in the scene.
  • Having the source "in scene", doesn't seem to make a difference.

    Could perhaps be interesting as a future feature to allow the video player component to act as an element of an AC menu.

    Thanks.
  • There shouldn't be a need to - I've just tried it and it works for me fine.

    In my Canvas's hierarchy, I have a VideoPlayer component that renders to a Render Texture, and that Render Texture is used by a Raw Image on a separate object.  I then made my Canvas a prefab, and hooked it up to the Menu Manager as normal.

    Try removing Playmaker from things for the moment, and just have the VideoPlayer play on awake.
  • edited May 2018
    The problem is not due to Playmaker, I have created an empty project with just AC and my video player prefab. This project just opens an AC menu when it starts and as you will see, the menu display correctly, but the raw image in which video renders remains black (you can hear the video playing).

    If I have this play outside of an AC menu in my game and it works, so there must be something I'm missing or a problem somewhere. Let me know if you can spot the issue.

    I will send you a link to the test project as a message.
  • edited May 2018
    There is an issue with sending RenderTextures to RawImage components via the Menu Manager - I will address that in the next release.

    However, since the RenderTexture is already assigned to the RawImage prefab, it's not necessary in this case to link it up to the Menu Manager.  Delete the element in the Menu Manager, and then remove the Material from the RawImage component, so that the "Video Renderer" texture is directly assigned.  It should then work.
  • Pleased to see that I was not totally crazy (you sometimes wonder after spending hours on some issues) and that it will help improve AC.

    Following your instructions does make it work. Thanks again.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.