Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!