// When a remote user joined, this delegate will be called. Typically // create a GameObject to render video on it protected virtual void OnUserJoined(uint uid, int elapsed) { Debug.Log("onUserJoined: uid = " + uid + " elapsed = " + elapsed); // find a game object to render video stream from 'uid' GameObject go = GameObject.Find(uid.ToString()); if (!ReferenceEquals(go, null)) { return; // reuse } // create a GameObject and assign to this new user VideoSurface videoSurface = makeImageSurface(uid.ToString()); if (!ReferenceEquals(videoSurface, null)) { // configure videoSurface videoSurface.SetForUser(uid); videoSurface.SetEnable(true); videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage); videoSurface.SetGameFps(30); videoSurface.EnableFilpTextureApply(enableFlipHorizontal: true, enableFlipVertical: false); UserVideoDict[uid] = videoSurface; Vector2 pos = AgoraUIUtils.GetRandomPosition(100); videoSurface.transform.localPosition = new Vector3(pos.x, pos.y, 0); } }