fix: Update button container path to reflect correct hierarchy and improve logging

This commit is contained in:
2025-12-15 09:51:02 +01:00
parent 3d5a53f0e2
commit 4d8279719c

16
Main.cs
View File

@@ -209,21 +209,11 @@ namespace KCM
} }
} }
// Try different paths to find the button container // Correct path based on debug output: MainMenuUI -> MainMenu -> TopLevel -> Body -> ButtonContainer -> New
var buttonContainer = Constants.MainMenuUI_T.Find("TopLevelUICanvas/TopLevel/Body/ButtonContainer/New"); var buttonContainer = Constants.MainMenuUI_T.Find("MainMenu/TopLevel/Body/ButtonContainer/New");
if (buttonContainer == null) if (buttonContainer == null)
{ {
// Try without TopLevelUICanvas prefix Main.helper.Log("Button container not found at MainMenu/TopLevel/Body/ButtonContainer/New");
buttonContainer = Constants.MainMenuUI_T.Find("TopLevel/Body/ButtonContainer/New");
}
if (buttonContainer == null)
{
// Try direct path
buttonContainer = Constants.MainMenuUI_T.Find("Body/ButtonContainer/New");
}
if (buttonContainer == null)
{
Main.helper.Log("Button container not found in any path");
return; return;
} }
Main.helper.Log($"Found button container at: {buttonContainer.name}"); Main.helper.Log($"Found button container at: {buttonContainer.name}");