private void Start() { peerConnectionManager = NetworkScene.FindNetworkScene(this). GetComponentInChildren <VoipPeerConnectionManager>(); if (peerConnectionManager) { peerConnectionManager.OnPeerConnection.AddListener(OnPeerConnection, true); } }
/// <summary> /// Find the AvatarManager for forest the Component is a member of. May return null if there is no AvatarManager for the scene. /// </summary> public static AvatarManager Find(MonoBehaviour Component) { try { return(NetworkScene.FindNetworkScene(Component).GetComponentInChildren <AvatarManager>()); } catch { return(null); } }
/// <summary> /// Find the VoipConnectionManager for forest the Component is a member of. May return null if there is no Voip manager for the scene. /// </summary> public static VoipPeerConnectionManager Find(MonoBehaviour Component) { try { return(NetworkScene.FindNetworkScene(Component).GetComponentInChildren <VoipPeerConnectionManager>()); } catch { return(null); } }
private bool TryGetAvatarManager(out AvatarManager avatarManager) { try { avatarManager = NetworkScene.FindNetworkScene(this) .GetComponentInChildren <AvatarManager>(); } catch (System.NullReferenceException) { avatarManager = null; } return(avatarManager); }
private void SetTexture(Texture2D texture) { if (!networkScene) { networkScene = NetworkScene.FindNetworkScene(this); if (!networkScene) { return; } } var avatar = networkScene.GetComponentInChildren <AvatarManager>().LocalAvatar; var texturedAvatar = avatar.GetComponent <TexturedAvatar>(); if (texturedAvatar) { texturedAvatar.SetTexture(texture); } }
public static void ChangeScene(MonoBehaviour caller, string sceneName) { var manager = FindSceneManager(NetworkScene.FindNetworkScene(caller)); manager.ChangeScene(sceneName); }
public static GameObject SpawnPersistent(MonoBehaviour caller, GameObject prefab) { var spawner = FindNetworkSpawner(NetworkScene.FindNetworkScene(caller)); return(spawner.SpawnPersistent(prefab)); }