Start a new topic

UI: Button for showing a video isn't working. Button with a link to an URL works only sometimes

Hello everyone


I have two problems with my UI.


I'm trying to show a video after clicking on a button. However when I click on the button nothing happens. Inside the Canvas I have the button for the Video and both a text and a Panel as children.


My plan was to hide the panel, so that it only shows after clicking on it


Here's the Code to open the panel.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PanelOpen : MonoBehaviour
{
    public GameObject Panel;
    
    public void OpenPanel()
    {
        if(Panel != null)
        {
            Panel.SetActive(true);
        }
    }
   
}

My second problem is regarding the opening of an URL by clicking on a button. Sometimes it works and opens the URL, but sometimes nothing happens. Do you know what could be wrong?


Unity Version: 2020.1.11.f1

Wikitude Version: 9.5 Expert edition


Thanks in advance


Hierarchy.png
(13.5 KB)
1 Comment

Hi Sammy,


which Render Mode on the VideoPlayer component are you using? You might want to use "Render Texture" as the mode, create a Render Texture, link that Render Texture in the VideoPlayer component and also link it in your UI with a Raw Image component....

If you anyways just want to display a fullscreen video you may want to use the method in this link.


Regarding your second issue... I don't have any clue... Might be that you are blocking the button with the Panel you are setting active? You could simply do a Debug.Log on a button press and have a look if the method linked to it is reached at all... For opening the URL I otherwise guess that you are using Application.OpenURL (link)... that shouldn't be as buggy as you described it...



Furthermore, as much as we enjoy helping people out here in the forum, this topic is not really Wikitude related, but rather a Unity topic...

In the Unity forums you might get better support on solely Unity related topics...

Kind regards,
Gökhan

Login or Signup to post a comment