Log in or register to post comments

videoplayer not visible but sound playing

June 24, 2019 - 10:26am #1

I writing this code by tutorials. 

My steps: set cloud image target, in child add gameobject Quad (rename to "Player") and add component VideoPlayer and SoundSource.

Add this script to Cloud Recognition and set parametrs.

Quad and VideoPlayer not visible, but sound video is playing if image found

Why ? What is problem ? plzzz Help!!!! :)

Version Unity 2018.3.14.f1 and i change version, but no success problem.

p.s. sorry for my bad eng

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Vuforia;
using UnityEngine.Video;
using UnityEngine.Networking;

public class SimpleCloudHandler : MonoBehaviour, IObjectRecoEventHandler

public ImageTargetBehaviour behaviour;
protected CloudRecoBehaviour cloud;
public GameObject mainPlayer;

    // Start is called before the first frame update
    void Start()
     CloudRecoBehaviour cloudReco = GetComponent<CloudRecoBehaviour> ();
   if (cloudReco) {
    cloudReco.RegisterEventHandler (this);
   cloud = cloudReco;
   mainPlayer = GameObject.Find ("Player");
   Hide (mainPlayer);


    // Update is called once per frame
    void Update()

public void OnInitialized(TargetFinder targetFinder) {

     Debug.Log ("Cloud Reco initialized" + targetFinder . ToString ( ));


public void OnInitError(TargetFinder.InitState initError) {

   Debug.Log ("Cloud Reco init error " + initError.ToString());


public void OnUpdateError(TargetFinder.UpdateState updateError) {

    Debug.Log ("Cloud Reco update error " + updateError.ToString());


public void OnStateChanged(bool scanning) {

  if (scanning) {
   ObjectTracker tracker = TrackerManager.Instance.GetTracker<ObjectTracker>();
   tracker.GetTargetFinder<ImageTargetFinder>().ClearTrackables (false);
   Debug.Log ("scanning true");
   Debug.Log ("scanning false");


public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult) {

  Debug.Log ("OnNewSearchResult");

   GameObject newImageTarget = Instantiate (behaviour.gameObject) as GameObject;
  mainPlayer = newImageTarget.transform.GetChild (0).gameObject;
  GameObject augmentation = null;
  if (augmentation != null) {
   Debug.Log ("augmentation 1= null");
   augmentation.transform.SetParent (newImageTarget.transform);

  if (behaviour) {
   ObjectTracker tracker = TrackerManager.Instance.GetTracker<ObjectTracker>();

   ImageTargetBehaviour imageTargetBehaviour = (ImageTargetBehaviour)tracker.GetTargetFinder<ImageTargetFinder>().EnableTracking (targetSearchResult, newImageTarget);

   TargetFinder.CloudRecoSearchResult cloudRecoSearchResult = (TargetFinder.CloudRecoSearchResult)targetSearchResult;

  string URL = cloudRecoSearchResult.MetaData.Trim();

  VideoPlayer vPlayer = mainPlayer.GetComponent<VideoPlayer> ();

  vPlayer.url = URL;

  Debug.Log ("Play");

  cloud.CloudRecoEnabled = true;


void Hide (GameObject ob) {
  Debug.Log ("hide");
  Renderer[] rends = ob.GetComponentsInChildren<Renderer> ();
  Collider[] cols = ob.GetComponentsInChildren<Collider> ();
  foreach (var item in rends) {
   item.enabled = false;
  foreach (var item in cols){
   item.enabled = false;

Image icon Снимок.PNG105.67 KB
Log in or register to post comments