Skip to content

Fix/recttransform null guard#25

Open
Krono159 wants to merge 2 commits into
IsThatTheRealNick:mainfrom
Krono159:fix/recttransform-null-guard
Open

Fix/recttransform null guard#25
Krono159 wants to merge 2 commits into
IsThatTheRealNick:mainfrom
Krono159:fix/recttransform-null-guard

Conversation

@Krono159
Copy link
Copy Markdown

@Krono159 Krono159 commented May 9, 2026

Fix: MenuButton.rectTransform is now explicitly assigned from REPOButton.Awake() — prevents NullReferenceException in SemiFunc.UIGetRectTransformPositionOnScreen when hovering over admin menu buttons. This occurs because in recent game versions, MenuButton.Awake() does not guarantee the rectTransform field is initialized in time.

Krono159 added 2 commits May 9, 2026 08:21
    - Fix: MenuButton.rectTransform is now explicitly assigned from REPOButton.Awake() — prevents NullReferenceException in SemiFunc.UIGetRectTransformPositionOnScreen when hovering over admin menu buttons. This occurs because in recent game versions, MenuButton.Awake() does not guarantee the rectTransform field is initialized in time.
Copilot AI review requested due to automatic review settings May 9, 2026 13:35
@Krono159
Copy link
Copy Markdown
Author

Krono159 commented May 9, 2026

first time trying to merge, sorry for the mess in the previous request ^^'

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a NullReferenceException caused by MenuButton.rectTransform not being initialized early enough in newer game versions, by explicitly assigning the rectTransform field from REPOButton.Awake() via reflection.

Changes:

  • Added a reflected FieldInfo handle for MenuButton.rectTransform.
  • Updated REPOButton.Awake() to set MenuButton.rectTransform when the MenuButton component is present.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
MenuLib/REPOReflection.cs Adds a reflected field reference for MenuButton.rectTransform so it can be assigned explicitly.
MenuLib/MonoBehaviors/REPOButton.cs Sets MenuButton.rectTransform during Awake() to prevent hover-time NREs in UI positioning code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Krono159
Copy link
Copy Markdown
Author

Krono159 commented May 9, 2026

idk why copilot started doing this for me... i'll try to disable it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants