Skip to content

fix: NetcodeSettingsProvider Exception [MTT-5217] #2345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

NoelStephensUnity
Copy link
Collaborator

Since UI Element helper classes were being instantiated when they were declared, when entering into play mode, in unity 2020.3.x versions, the EditorStyles.label was not yet assigned and would throw an exception (in 2021 and later versions EditorStyles.label is assigned at that point in time). This PR resolves the issue by instantiating the helper classes when OnGuiHandler is invoked.

MTT-5217

Changelog

  • Fixed: Issue where NetcodeSettingsProvider would throw an exception in Unity 2020.3.x versions.

Testing and Documentation

  • No tests have been added.
  • No documentation changes or additions were necessary.

This fixes the exception in 2020.3.x versions of Unity where the EditorStyles.label is not yet set when instantiating label and toggle elements during declaration (unlike later versions of Unity where it does).
adding one more comment
MTT-5217
Removing some changes that I had added when trying to narrow down where this issue was happening in 2020.3.x versions of Unity.
MTT-5217
Adding changelog entry.
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review December 12, 2022 15:56
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner December 12, 2022 15:56
@@ -56,7 +88,7 @@ public void DrawLabel()
public NetcodeSettingsLabel(string labelText, float layoutOffset = 0.0f)
{
m_LabelContent = labelText;
AdjustLableSize(labelText, layoutOffset);
AdjustLabelSize(labelText, layoutOffset);
Copy link
Contributor

Choose a reason for hiding this comment

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

😄

@NoelStephensUnity NoelStephensUnity enabled auto-merge (squash) December 12, 2022 16:29
@NoelStephensUnity NoelStephensUnity merged commit b8f3929 into develop Dec 12, 2022
@NoelStephensUnity NoelStephensUnity deleted the fix/netcodesettingsprovider-exception-mtt-5217 branch December 12, 2022 16:52
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