-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Some minor reworks to use TryGetComponent in every-frame pointer code #10315
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
Some minor reworks to use TryGetComponent in every-frame pointer code #10315
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
per @keveleigh, the alloc only occurs in the editor. this pattern should be utilized going forward (v3). given 2018 does not contain the TryGetComponent API, it feels like a more risky change for the v2 code base |
395c32d to
8aac939
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
With the goal of trying to improve performance in as many code paths as possible (especially with regards to pointers and focus!), I think we should reevaluate taking this change for 2.8. I've retargeted the branch to ensure our tests continue to succeed there. |
8aac939 to
ae08c53
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Overview
While digging into #10310, I noticed a couple spots where
GetComponenton objects without the corresponding component were both costly and caused allocations. Unity 2019 introducedTryGetComponent, which helps reduce those side effects.Before:


After:
