You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
851 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Networking;
  5. namespace Networking.Server
  6. {
  7. /// <summary>
  8. /// Component to control server
  9. /// </summary>
  10. public class ServerManager : MonoBehaviour
  11. {
  12. #region Inspector Fields
  13. [Header("Server Settings")]
  14. [SerializeField]
  15. private int Port;
  16. [SerializeField]
  17. private bool StartServerOnAwake;
  18. [Header("References")]
  19. [SerializeField]
  20. private ServerObject Server;
  21. #endregion Inspector Fields
  22. private void Awake()
  23. {
  24. if (StartServerOnAwake)
  25. {
  26. Server.StartServer();
  27. }
  28. }
  29. private void Update()
  30. {
  31. Server.ServerUpdate();
  32. }
  33. }
  34. }