Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Want to see camera streaming in Hololens

Discussion in 'AR' started by ArthurEmcon2, Dec 6, 2021.

  1. ArthurEmcon2

    ArthurEmcon2

    Joined:
    Nov 18, 2021
    Posts:
    2
    Greetings

    I am in a project where some cameras have to be streamed in Hololens. The streams are printed as textures of planes with a C# script. The unity project of the next picture shows the stream happening successfully:

    upload_2021-12-6_14-29-45.png

    The current issue is that when the project is imported to Visual Studio and the Hololens emulator is called, the planes go blank

    upload_2021-12-6_14-29-15.png

    The C# script that I'm using is at the end of this message. It is important to note that when the project is correctly executed in Unity, it shows the warning "The referenced script on this Behaviour (Game Object 'Plane') is missing!" for each plane.

    Also, when the emulator is called, there is an error "Exception generated 0x00007FFBF3CD022C in New Unity Project.exe: Microsoft C++ Exception: Platform::COMException ^ At memory address 0x00000052869FE2E8. HRESULT:0x800C000E A security problem occurred.
    Informações de WinRT: A security problem occurred.'


    C# script:

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

    public class LoadTextureFromURL : MonoBehaviour
    {

    public string TextureURL = "";

    // Start is called before the first frame update
    void Start()
    {
    StartCoroutine(DownloadImage(TextureURL));
    }

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

    }

    IEnumerator DownloadImage(string MediaUrl)
    {
    UnityWebRequest request;
    request = UnityWebRequestTexture.GetTexture(MediaUrl);
    yield return request.SendWebRequest();
    if (request.isNetworkError || request.isHttpError)
    Debug.Log(request.error);
    else
    this.gameObject.GetComponent<Renderer>().material.mainTexture = ((DownloadHandlerTexture)request.downloadHandler).texture;
    }
    }
     

    Attached Files:

  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958