Conversation
| { | ||
| Array.Fill(s_ColliderBuffer, null); | ||
| Array.Fill(s_ColliderDistanceBuffer, 0f); | ||
| Array.Fill(s_ColliderOrderBuffer, 0); |
There was a problem hiding this comment.
FYI i am fixing the analyzer to consider calls to Array.Fill as successful initialization
There was a problem hiding this comment.
These don't need to be initialized at all, as they are just scratch buffers. I would have disabled the warning here.
com.unity.cinemachine/Runtime/Deprecated/CinemachineFreeLook.cs
Outdated
Show resolved
Hide resolved
richardk-u3d
left a comment
There was a problem hiding this comment.
some commented out bits im not sure about, but overall looks good
richardk-u3d
left a comment
There was a problem hiding this comment.
need to figure out if having 2 RuntimeInitializeOnLoadMethod's is something we want to allow. the analyzer gets confised by it.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
PR Code Suggestions ✨🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
| { | ||
| Array.Fill(s_ColliderBuffer, null); | ||
| Array.Fill(s_ColliderDistanceBuffer, 0f); | ||
| Array.Fill(s_ColliderOrderBuffer, 0); |
There was a problem hiding this comment.
These don't need to be initialized at all, as they are just scratch buffers. I would have disabled the warning here.
| [RuntimeInitializeOnLoadMethod] | ||
| private static void ResetStaticsOnLoad() | ||
| { | ||
| s_StoryboardGlobalMute = false; |
There was a problem hiding this comment.
We don't want to be resetting this on domain reload. It's value should be taken from CinemachineCorePrefs.StoryboardGlobalMute.Value
| [RuntimeInitializeOnLoadMethod] | ||
| private static void ResetStaticsOnLoad() | ||
| { | ||
| Array.Fill(s_Buffer, 0f); |
There was a problem hiding this comment.
no need to fill the buffer with anything
There was a problem hiding this comment.
Yes, I know they are scratch buffers, but it's preferable to zero-out/clear dangling information from scratch buffers than to add an exception for these imho ... @richardk-u3d Do you have any feedback for these use cases?
There was a problem hiding this comment.
If they really do not need clearing, I suppose we are wasting performance/hurting enter playmode time by clearing them. If that's the case, I would suppress the warning instead. (though it's your call - you are the owners/area experts)
If you choose to suppress the warning instead, please just include a comment explaining why it does not need resetting, so it's obvious for future readers.
| Array.Fill(s_HitBuffer, default); | ||
| Array.Fill(s_PenetrationIndexBuffer, 0); |
There was a problem hiding this comment.
No need to fill these buffers
There was a problem hiding this comment.
As with the other cases of "you dont need to", if you change this to suppress the warning, it would be good to include a comment saying why it does not need resetting.
| { | ||
| s_AvailableStringBuilders = null; | ||
| OnGUIHandlers = null; | ||
| GameViewGuidesEnabled = false; |
There was a problem hiding this comment.
Should be initialized to CinemachineCorePrefs.ShowInGameGuides.Value
| [RuntimeInitializeOnLoadMethod] | ||
| private static void ResetStaticsOnLoad() | ||
| { | ||
| Array.Fill(s_ColliderBuffer, null); |
There was a problem hiding this comment.
not needed, unless having stale Collider pointers upsets c# and unity
Purpose of this PR
https://jira.unity3d.com/browse/UUM-131015
Static variable management in Cinemachine to support fast enter playmode.
We'll need to add exceptions for
Testing status
[Explanation of what’s tested, how tested and existing or new automation tests. Can include manual testing by self and/or QA. Specify test plans. Rarely acceptable to have no testing.]
Documentation status
[Overview of how documentation is affected by this change. If there is no effect on documentation, explain why. Otherwise, state which sections are changed and why.]
Technical risk
[Overall product level assessment of risk of change. Need technical risk & halo effect.]
Comments to reviewers
[Info per person for what to focus on, or historical info to understand who have previously reviewed and coverage. Help them get context.]
Package version
[Justification for updating either the patch, minor, or major version according to the semantic versioning rules]