Things to Consider
Last Updated - 3-19-2021

Easy Code For Vivox

Bridging the gap between Solo/Indie developer teams and AAA games that implement Voice or Text Chat

Supports

This asset only supports Unity Game Engine.
System Versions
  • Windows
  • Android
This asset may work with IOS, Mac, Linux, or Consoles. Implement at your own discretion. Since the source is included you can modify it.
Vivox Voice and Text Chat is a separate asset and does support all major platforms and consoles

Dependencies

This asset is a simple API to interact with the Vivox Unity SDK available in the Unity Asset Store as Vivox Voice And Text Chat. This asset is built on top of Vivox Voice And Text Chat and will not work without it (You can also download the SDK through Vivox’s website and this asset will still work if that is your preferred method). You must create an account with Vivox at Login - Vivox Developer Portal and agree to Vivox’s Terms before you can use their services.

Know what you're doing?

If you know what you're doing and want to see code ASAP then here goes. VivoxManager.cs is the highest abstraction away from the Vivox Unity SDK and the easiest script to use. VivoxBehaviour.cs is a mid-level abstraction containing variable instances for the scripts located in Assets/Easy Code For Vivox/Scripts/Vivox Backend/ Feel free to modify the code, redistribute, or sell. This asset is meant for the community and small teams and there will always be a free version.

Want To Customize This Asset

Vivox Backend folder contains all the scripts you need to implement Vivox Voice and Text Chat functionality. If you want to start learning Vivox from scratch or implement your own code look at the scripts in the Vivox Backend folder. The code they contain are very similar to the Vivox Documentation and it will be easier to implement Vivox from scratch after having working code examples to compare to the Vivox Documentation
It is recommended to inherit from VivoxManager.cs or create your own version/extension of VivoxBehaviour.cs using the scripts in VivoxBackend/ The reason being is if there is an update to this asset your project may break if you update to the newest version of this asset.
** Don’t change the name of VivoxManager.cs or VivoxBehaviour.cs or you risk breaking this asset and any future updates.

Things To Consider

Recommended to have some experience using the Unity UI and C#. This project is intended to be Indie friendly and to provide easy interactions with the Vivox Unity SDK. Built specifically for people who don't have time to learn how to use Vivox from scratch.
Although it’s not necessary for almost all game types that will implement Vivox you will need a networking solution such as the following. There are more solutions so do your research before choosing the best solution for your game.
Keep in mind MLAPI will eventually be Unity’s fully adopted network solution called NetCode but is currently in preview. I am not sure if it’s a branch from MLAPI or will replace MLAPI so do you research.
Mirror
Mirage
MLAPI
Photon - Multiple Networking SDK’s To Choose
DarkRift
Even after you have chosen a networking solution, to get your game approved by Vivox for production status (out of sandbox mode) your players need to get authorization tokens (used for secure voice communications and keeps your Vivox credentials out of client / game / app code) from a dedicated server or possibly use cloud lambda functions(tested it with Amazon Lambda and it works) to receive proper Vivox Access Tokens. You can choose to keep your player count under < 5000 player limit and in sandbox mode but it still poses a security risk and not recommended. Also limits your game from being successful.
With all this in mind this asset does not provide networking code or solve the problem of getting Vivox Access Tokens(VAT’s) from a dedicated server. This asset does provide production code methods and examples but still poses the problem of requesting VAT’s directly from the client. One solution is to have a custom game server request the VAT’s from Vivox’s servers and then pass the VAT to the client so they can connect securely.
Also at the time of this writing Vivox Presence Feature does not support access to information on any players connected to their server(currently buggy). This makes it borderline impossible to send direct messages to players because players will have no knowledge of who is currently online. Your players would have to actually know each other or meet on a forum or Discord community and exchange usernames to be able to communicate with each other.
With this in mind if you are using a dedicated server you can implement your own functionality. If you're not using a networking solution(or don’t want to implement your own system) then I would recommend using one of the following multiplayer integrations. There may be better options or for your game so do your research.
Playfab
GameSparks
Firebase

Design Considerations

  • Demo Scenes to test Vivox quickly and see if this is the right communications choice for your game/app or to see if this is the right asset for you.
  • Designed with static variables and events instead of Singleton design pattern for persistent data across scenes and to subscribe to events from different classes.
  • Designed VivoxManager.cs to be inherited from or referenced using GetComponent<VivoxManager>();
  • Balance of Ease of Use and Performance (My system is pretty performant so results may vary)
Designed with scaling in mind but if you think your game is going to have over 50, 000 players or need an enterprise solution I would look at Assets/Easy Code For Vivox/Scripts/Vivox Backend/ and VivoxBehaviour.cs And implement your own solution based on the code in this asset.

Getting Started

Demo Scenes
After importing Easy Code For Vivox into your project from the Unity Asset Store open the scenes folder in Assets/Easy Code For Vivox/Scenes you will see all the available demo scenes in the current version you have imported. All the demo scenes use the basic Unity UI and come ready to use so you can see Vivox in action ASAP (As soon as possible).
I would recommend newer developers to use the 'VivoxManager with Inherited Example' scene to begin with. If you use Mirror Networking the workflow will be similar.
More experienced developers who want more freedom are recommended to use the demo scene 'VivoxManager with Reference Example' scene because you're required to choose which events you want to subscribe to and required to implement the callback methods necessary which is more work but also allows more freedom and better performance.
The 'VivoxManager PlayMaker Example' scene in the picture below
🧐
is in Beta testing at the moment and may be added later or published as a separate asset. NO GUARANTEES Though!!!
😬
Inside of Assets/Scripts/EasyCodeForVivox/ folder you will see a script called VivoxManager.cs The example scripts mentioned above are either inheriting or referencing VivoxManager.cs Feel free to change the class name of the example scripts** or create your own from VivoxManager.cs This is the main script you will be working with. It contains higher level methods (not as complex) to be able to access Vivox functionality to be used in void methods for buttons or UI elements in Unity.
** Don’t change the name of VivoxManager.cs or VivoxBehaviour.cs or you risk breaking this asset and any future updates.
** Also in Visual Studio 2019 if you click on the name of a script and hold Control and then press R twice ( ctrl + R + R ) you will automatically rename any reference to the script you want to rename. Recommended if your using the default example scripts that come with asset because there names are long

Setup

In the VivoxManager game object in the VivoxManager with Reference Example demo scene add your Vivox Credentials in the Inspector window.
Your credentials are located in the Vivox Developer Portal after you create an application.
Enter your Vivox credentials like in the picture below
After your credentials are set press play to test. You can build the demo scene to test with 2 devices [ Currently this asset only supports Windows 10 and Android ] to ensure asset works as intended before using the methods or scripts in your own project
Last modified 9mo ago