private void SetPlayerObjectActive(bool _isActive) { if (_isActive) { PlayerController.SetTransformPosition(SpawnLocationManager.GetRandomSpawn()); } IsPlayerActive.Value = _isActive; }
static void StartButtons() { if (GUILayout.Button("Host")) { NetworkManager.Singleton.ConnectionApprovalCallback += ClientConnectionApproval; NetworkManager.Singleton.StartHost(SpawnLocationManager.GetRandomSpawn(), Quaternion.identity); } if (GUILayout.Button("Client")) { NetworkManager.Singleton.StartClient(); } if (GUILayout.Button("Server")) { NetworkManager.Singleton.StartServer(); } }
public void Host() { //NetworkManager.Singleton.ConnectionApprovalCallback += ClientConnectionApproval; NetworkManager.Singleton.StartHost(SpawnLocationManager.GetRandomSpawn(), Quaternion.identity); }
private static void ClientConnectionApproval(byte[] connectionData, ulong clientId, NetworkManager.ConnectionApprovedDelegate callback) { ulong?prefabHash = NetworkSpawnManager.GetPrefabHashFromGenerator(PlayerPrefabHashString); callback(true, prefabHash, true, SpawnLocationManager.GetRandomSpawn(), Quaternion.identity); }