Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda