private void Load() { #if UNITY // In unity editor set synchronizer from the inspector #else var path = Path.Combine(RootPath, AssetBundleName); var bundle = AssetBundle.LoadFromFile(path); if (bundle == null) { PTLogger.Error($"Failed to load ParallelTasker asset bundle from {path}."); return; } var prefab = bundle.LoadAsset <GameObject>("Synchronizer"); m_synchronizer = Instantiate(prefab); bundle.Unload(true); #endif if (m_synchronizer == null) { PTLogger.Error("Could not load synchronizers"); return; } m_synchronizer.SetActive(true); foreach (var sync in m_synchronizer.GetComponents <IPTSynchronizer>()) { PTLogger.Debug($"Adding {sync} to known synchronizers"); s_synchronizers.Add(sync.EventTime, sync); } }
private void Initialize(Func <PTTimePair, T> create) { var factory = create ?? (pair => default(T)); foreach (var group in PTUtils.GetAllTimePairs()) { try { this[group] = factory(group); } catch (Exception) { PTLogger.Error($"Error while initializing {this} with {group.ToString()}"); throw; } } }