'AGORA.IO for Unity. Official tutorial has a problem [closed]

So, I was trying AGORA.IO with Unity and to start I followed their blog on - medium.com and an official video on youtube. If anyone has used Agora, Can you please explain why are they creating a CUBE and a CYLINDER for ? They both render local stream.

And when the app is run and 2 devices are connected, A third Gameobject appears which shows stream of the remote user. So in total we get 3 gameobjects which is really messy.

What's the need to create 2 objects to show same local stream ? How can I add operations on remote user's stream (Camera effects etc) ? And change it's position ?

Thanks !



Solution 1:[1]

Thank you for your feedback. I was the creator of both the Medium and YouTube video tutorial.

The demo scenes were created by a member of Agora's engineering team as an example of how to use Agora's SDK and with a few different examples of how to show the video streams on game objects. I cannot say why he chose to use this specific content for his scene, but on a positive note, the Agora team is working on an updated set of demos that provide more relevant examples. We are planning to release these new scenes with the next update of the Agora Unity SDK.

For now, the best I can do is provide some clarity as to how you can edit this scene.

By default a game object with a VideoSurface component will display the local stream, but if you take the reference to the GameObject and use .setForUser() and pass the UID (from Agora) you can make any user appear on a given video surface.

The purpose of creating a new Game Object when a user joins the channel is to show how to programmatically create a Game Object, assign it the remote user's stream and then add it to the Scene.

With regard to the local stream slowing down with two game objects, thats very relative to the device you are using.

With regard to camera effects on remote streams, I would recommend you make those effects on the local stream before sending them to the remote user.

With regard to changing "it's" position, if you mean the programmatically generated GameObject, you have a reference to it within the OnUserJoined callback.

private void OnUserJoined (uint uid, int elapsed)
    {
        Debug.Log("New user has joined channel with id: " + uid);

        // add remote stream to scene

        // create game object
        GameObject go = GameObject.CreatePrimitive(PrimitiveType.Plane);

You can change its position the same way as any other Game Object in Unity, using the .transform.position property and assign whatever location you'd like.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1