private void OnDestroy() { Plugin.Log?.Debug($"{name}: OnDestroy()"); if (Instance == this) { Instance = null; // This MonoBehaviour is being destroyed, so set the static instance property to null. } }
void Awake() { if (!settingsView) { settingsView = BeatSaberUI.CreateViewController <SettingsView>(); } if (!antiLagModController) { antiLagModController = FindObjectOfType <AntiLagModController>(); } }
private void Awake() { // For this particular MonoBehaviour, we only want one instance to exist at any time, so store a reference to it in a static property // and destroy any that are created while one already exists. if (Instance != null) { Plugin.Log?.Warn($"Instance of {GetType().Name} already exists, destroying."); DestroyImmediate(this); return; } DontDestroyOnLoad(this); // Don't destroy this object on scene changes Instance = this; Plugin.Log?.Debug($"{name}: Awake()"); }
protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) { try { if (firstActivation) { SetTitle("Anti Lag Mod"); showBackButton = true; ProvideInitialViewControllers(settingsView); } } catch (Exception exception) { AntiLagModController.ExternalCriticalError("ALMFlowCoordinator.cs", 37, exception); } }
public void Create() { try { Plugin.Log.Debug("Creating text object"); // setup text obj gameObject.transform.localScale = scale; dasCanvas = gameObject.AddComponent <Canvas>(); dasCanvas.renderMode = RenderMode.WorldSpace; var rectTransform = (RectTransform)dasCanvas.transform; rectTransform.sizeDelta = canvScale; indicatorTMPText = BeatSaberUI.CreateText(rectTransform, "", canvAnchorPos); indicatorTMPText.alignment = TextAlignmentOptions.Center; indicatorTMPText.overflowMode = TextOverflowModes.Overflow; indicatorTMPText.fontSize = textFontSize; //indicatorTMPText.enableWordWrapping = false; indicatorTMPText.rectTransform.position = rectTransformPos; } catch (Exception exception) { AntiLagModController.ExternalCriticalError("TextObj.cs", 0, exception); } }