0

I'm a completely beginner with HoloLens and Unity3D. Right now, I have two scripts the first one which reads a QR code (works perfectly) is shown below and the second one that shows a pop up window. The idea is when a QRcode is recognized the popup window appears immediatly. However, I tried using the SendMessage('DialogShow') command but nothing happens and I don't know exactly why. Anyone have any suggestions?

I would appreciate your help. :)

QR code (script)

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

public class Placeholder : MonoBehaviour
{
  public Transform textMeshObject;
  private void Start()
  {
    this.textMesh = this.textMeshObject.GetComponent<TextMesh>();
    this.OnReset();
  } 

  public void OnScan()
  {
     this.textMesh.text = "Scannen 30s für einen QR-Code";


#if !UNITY_EDITOR
    MediaFrameQrProcessing.Wrappers.ZXingQrCodeScanner.ScanFirstCameraForQrCode(
        result =>
        {
          UnityEngine.WSA.Application.InvokeOnAppThread(() =>
          {
            if (result != null && result == "Guided Assembling"){
                this.textMesh.text = "a ";
                this.SendMessage("DialogShow");
            }
            else if (result != null){
                this.textMesh.text = result;
            }
            else{
                this.textMesh.text = "not found";
            }
          }, 
          false);
        },
        TimeSpan.FromSeconds(30));
#endif
    } 

public void OnReset()
  {
    this.textMesh.text = "sagen 'scan' zu starten";
  }
  TextMesh textMesh;
}

Pop up window code

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;

public class PopUpWindow : MonoBehaviour {

    public GameObject window, cText;
    public Text messageField, TitleField;

    // Use this for initialization
    void DialogShow (string message, string title) {

        cText.SetActive(false);
        messageField.text = message;
        TitleField.text = title;
        window.SetActive(true);
    }

    // Update is called once per frame
    void DialogHide() {
        window.SetActive(false);
    }
}
Margarita Gonzalez
  • 1,127
  • 7
  • 20
  • 39

0 Answers0