public static void CreatePoller(PhotonPlatformConfig config) { if (!_instance) { var pollers = FindObjectsOfType <PhotonPoller>(); if (pollers.Length == 0) { _instance = new GameObject(typeof(PhotonPoller).Name).AddComponent <PhotonPoller>(); } if (pollers.Length == 1) { _instance = pollers[0]; } if (pollers.Length >= 2) { _instance = pollers[0]; for (int i = 1; i < pollers.Length; ++i) { Destroy(pollers[i].gameObject); } } _instance._config = config; DontDestroyOnLoad(_instance); } }
public override void OnStartBegin() { base.OnStartBegin(); PhotonPoller.CreatePoller(_config); if (_config.UsePunchThrough) { _platform.OnStartBegin(); } }