Skip to content

Instantly share code, notes, and snippets.

@icywind
Created October 21, 2019 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icywind/e64b7336cd364d3fd35dec24b74ef11c to your computer and use it in GitHub Desktop.
Save icywind/e64b7336cd364d3fd35dec24b74ef11c to your computer and use it in GitHub Desktop.
manager to respond to the UI Toggle actions
using UnityEngine;
using UnityEngine.UI;
public class AgoraUIManager : MonoBehaviour
{
void Start()
{
SetPosition();
}
void SetPosition()
{
transform.position = new Vector3(Screen.width - 20, Screen.height - 100, 0);
}
public void OnMicToggle(Toggle toggle)
{
Debug.Log("Toggle mic " + toggle.isOn);
AgoraVideoController.instance.MuteMic(!toggle.isOn);
}
public void OnCamToggle(Toggle toggle)
{
Debug.Log("Toggle cam" + toggle.isOn);
AgoraVideoController.instance.MuteCamera(!toggle.isOn);
}
public void OnCamSwitch(Toggle toggle)
{
Debug.Log("Switch cam " + toggle.isOn);
AgoraVideoController.instance.SwitchCamera();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment