-
Notifications
You must be signed in to change notification settings - Fork 90
[UUM-131032] Coreclr - fast enter playmode #666
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
base: master
Are you sure you want to change the base?
Changes from all commits
4b0b09e
5b5ae78
56d2f30
1509998
7fc71d8
138fd5e
a960719
915ecce
8ca4b57
96dd0c4
972d1e3
42ce9da
539a7b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,14 @@ public class ShowHoveredInfo : MonoBehaviour | |||||||
| static Material m_Material; | ||||||||
| bool m_IsHovering; | ||||||||
|
|
||||||||
| #if UNITY_EDITOR | ||||||||
| [RuntimeInitializeOnLoadMethod] | ||||||||
| static void ResetStaticsOnLoad() | ||||||||
| { | ||||||||
| m_Material = null; | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🤖 Helpful? 👍/👎 |
||||||||
| } | ||||||||
| #endif | ||||||||
|
|
||||||||
| void Start() | ||||||||
| { | ||||||||
| if (m_Material == null) | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,22 @@ | |
| static EditorWindow s_NotificationWindow; | ||
| static bool s_IsNotificationDisplayed; | ||
|
|
||
| [InitializeOnEnterPlayMode] | ||
| static void ResetStaticsOnLoad() | ||
| { | ||
| s_IsNotificationDisplayed = false; | ||
| EditorApplication.update -= NotifUpdate; | ||
| if (s_NotificationWindow != null) | ||
| { | ||
| // Window may be destroyed when entering Play Mode without domain reload. | ||
| try { s_NotificationWindow.RemoveNotification(); } | ||
| catch {} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| s_NotificationWindow = null; | ||
| s_NotificationTimer = 0f; | ||
| } | ||
|
|
||
| [UserSetting("General", "Show Action Notifications", "Enable or disable notification popups when performing actions.")] | ||
| static Pref<bool> s_ShowNotifications = new Pref<bool>("editor.showEditorNotifications", false); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default load type for
RuntimeInitializeOnLoadMethodisAfterSceneLoad, which executes after the scene has loaded andAwakehas been called. If an instance ofShowHoveredInfoexists in the scene, itsStartmethod may run before this reset, causing it to initializem_Materialonly for it to be immediately nulled here. This can lead toNullReferenceExceptions if the material is used later and also results in a resource leak.Using
BeforeSceneLoadensures the static reference is cleared before any instance logic runs.🤖 Helpful? 👍/👎