Author Topic: Understanding NGUI use for simple video playback application  (Read 2286 times)

eco_bach

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Understanding NGUI use for simple video playback application
« on: January 19, 2017, 11:42:43 AM »
Hi
Would appreciate some feedback for a simple video playback application.
I am using 2 3rd party assets.
1 is AVPROVideo to play a full screen HD video

The 2nd is the odometer asset from the Asset store which depends on NGUI.

I am using a single NGUI 2D UI component
The AVProVideo player can target the NGUI UI texture inside the 2D UI component so only a single Camera (NGUI) is being used for both the video and odometer asset.

If I want to put an asset 'on top of' both my video and odometer, does it have to be a NGUI asset, or can it be a regular Unity Sprite or game object?
How would I create a 'camera in camera' or inset camera using a 2nd camera for debugging purposes?


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Understanding NGUI use for simple video playback application
« Reply #1 on: January 23, 2017, 07:58:27 AM »
What exactly are you trying to "target"? What do those 3rd party components expect to work with? Unless they were written to work with a UITexture in mind, you will need to figure out your own way of assigning UITexture's mainTexture property, which expects a texture. For example:
  1. using UnityEngine;
  2.  
  3. public class TextureSetter : MonoBehaviour
  4. {
  5.     public Texture tex;
  6.     void Start () { GetComponent<UITexture>().mainTexture = tex; }
  7. }

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Understanding NGUI use for simple video playback application
« Reply #2 on: January 23, 2017, 08:04:00 AM »
To answer the second part of your question, in order to put something on top of NGUI, you need to either create a new camera with a higher depth value to draw it with, or use NGUI -- meaning create a new panel with a higher depth than all others. If trying to put a 3D asset on top of NGUI, I recommend rendering whatever 3D asset you want on top to texture instead, then using NGUI to display that texture (via UITexture). I do preview icons in my current WIP game, Sightseer, using this method. Off-screen camera renders to texture when needed.