Skip to content

Dev improve #5

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

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

Dev improve #5

wants to merge 5 commits into from

Conversation

Szczyrk
Copy link
Collaborator

@Szczyrk Szczyrk commented Sep 26, 2024

No description provided.

// Initialize the component
private void Awake()
{
_rectTransform = GetComponent<RectTransform>();
Copy link
Contributor

Choose a reason for hiding this comment

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

What if RectTransform component cannot be found? There should be an error here if that happens, explaining exactly why it happened.

Copy link
Contributor

Choose a reason for hiding this comment

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

And if, the current component should be disabled to not print any more errors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If RectTransform is not found, the script now:

  • Logs an error explaining the issue.
  • Disables itself (enabled = false) to prevent further errors and repeated logging.

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