Skip to content

Commit

Permalink
Fully scroll up in experiments category in main menu
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianGlawogger committed Feb 20, 2025
1 parent dcf5b0e commit 95dbd32
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using GEAR.Localization.Text;
using Maroon.GlobalEntities;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;

Expand All @@ -21,12 +22,12 @@ public class scrMenuColumnLaboratorySelectionDetail : MonoBehaviour

[SerializeField] private GameObject ExperimentButtonPrefab;

private void Start()
private IEnumerator Start()
{
// Do not init anything if no category is selected, because no lab can be built and no experiments will show up
if(SceneManager.Instance.ActiveSceneCategory == null)
{
return;
yield break;
}

// Update Title
Expand Down Expand Up @@ -61,6 +62,11 @@ private void Start()
newButton.GetComponent<Button>().onClick.AddListener(() =>
Maroon.GlobalEntities.SceneManager.Instance.LoadSceneRequest(current_scene));
}

// Fully scroll up
yield return null; // Wait a frame for scrollRect to get updated
ScrollRect experimentsScrollRect = ExperimentButtonsContainer.GetComponentInParent<ScrollRect>();
experimentsScrollRect.verticalScrollbar.value = 1;
}

private void OnClickGo()
Expand Down

0 comments on commit 95dbd32

Please sign in to comment.