protected override void Awake()
        {
            base.Awake();

            if (_instance != null)
            {
                // Destroy, if this is not the first instance
                Destroy(gameObject);
                return;
            }

            _instance = this;

            Logger.LogLevel = LogLevel;

            // Move to root, so that it won't be destroyed
            if (transform.parent != null)
            {
                transform.SetParent(null);
            }

            DontDestroyOnLoad(gameObject);

            if (Msf.Args.IsProvided(Msf.Args.Names.MasterPort))
            {
                // If master port is provided via cmd arguments
                Port = Msf.Args.MasterPort;
            }
        }
Beispiel #2
0
        protected override void Awake()
        {
            base.Awake();

            // If instance of the server is already running
            if (Instance != null)
            {
                // Destroy, if this is not the first instance
                Destroy(gameObject);
                return;
            }

            // Create new instance
            Instance = this;

            // Move to root, so that it won't be destroyed
            // In case this MSF instance is a child of another gameobject
            if (transform.parent != null)
            {
                transform.SetParent(null);
            }

            // Set server behaviour to be able to use in all levels
            DontDestroyOnLoad(gameObject);

            // Check is command line argument '-msfMasterPort' is defined
            if (Msf.Args.IsProvided(Msf.Args.Names.MasterPort))
            {
                port = Msf.Args.MasterPort;
            }
        }
Beispiel #3
0
 private void OnMasterStatusChanged(MasterServerBehaviour obj)
 {
     UpdateRunningMasterView(obj.IsRunning);
 }