Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

119
Visualizações
Unity mirror and webcam streaming WebGL

I have a project in witch I use mirror (unet 2.0 :P) to make a simple low poly WebGL game in unity. the game works great. Now I want to send a webcamstream over the network. I want to do this for every player.

I managed to get the cam working locally. Now I want to get it to run via the network. I made a Colors32[] array witch holds the image, it also works locally. Only If I try to send it over the network using a [Command] function I get the message that my packet is to large. I heard that splitting a package gives a lot of latency so I tried this solution sendTextures but it doesn't play nice with mirror. I only get one frame (if I'm lucky) if I turn my networkmanager on.

Do you guys have any pointers for me to get it working?

This is the code I have so far:

public class WebCamScript : NetworkBehaviour
{
    static WebCamTexture camTexture;
    Color32[] data;

    private int width = 640, height = 480;

    public GameObject screen;

    void Start()
    {
        screen = GameObject.Find("screen");

        if (camTexture == null)
            camTexture = new WebCamTexture(width, height);

        data = new Color32[width * height];

        if (!camTexture.isPlaying)
            camTexture.Play();
    }

    // Update is called once per frame
   void Update()
   {
        CmdSendCam(data.Length, camTexture.GetPixels32(data));
   }

   [Command]
   void CmdSendCam(int length, Color32[] receivedImage)
   {
       /*       
        Texture2D t = new Texture2D(width, height);
    
        t.SetPixels32(receivedImage);
        t.Apply();
        screen.GetComponent<Renderer>().material.mainTexture = t;
       */
   }
}
over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda