Skip to content

Commit

Permalink
fix: examples no longer use prefabs or common files (#378)
Browse files Browse the repository at this point in the history
* condense DDOL and RunBackground into Hud

* updated example scenes to no longer use prefabs

* delete prefab folder
  • Loading branch information
uweeby committed Oct 3, 2020
1 parent 1715d71 commit 718ec9e
Show file tree
Hide file tree
Showing 17 changed files with 13,788 additions and 3,366 deletions.
10 changes: 10 additions & 0 deletions Assets/Mirror/Runtime/NetworkManagerHud.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ public class NetworkManagerHud : MonoBehaviour
public GameObject OnlineGO;
public Text StatusLabel;

private void Start()
{
DontDestroyOnLoad(transform.root.gameObject);
Application.runInBackground = true;
}

internal void OnlineSetActive()
{
OfflineGO.SetActive(false);
Expand All @@ -28,24 +34,28 @@ internal void OfflineSetActive()

public void StartHostButtonHandler()
{
StatusLabel.text = "Host Mode";
_ = NetworkManager.StartHost();
OnlineSetActive();
}

public void StartServerOnlyButtonHandler()
{
StatusLabel.text = "Server Mode";
_ = NetworkManager.server.ListenAsync();
OnlineSetActive();
}

public void StartClientButtonHandler()
{
StatusLabel.text = "Client Mode";
NetworkManager.client.ConnectAsync(NetworkAddress);
OnlineSetActive();
}

public void StopButtonHandler()
{
StatusLabel.text = string.Empty;
NetworkManager.StopHost();
OfflineSetActive();
}
Expand Down

0 comments on commit 718ec9e

Please sign in to comment.