public void RemoveDestroyedKeysTest() { var go = new GameObject(); var dictionary = new Dictionary <GameObject, object> { { go, null } }; UnityObjectUtils.Destroy(go); UnityObjectUtils.RemoveDestroyedKeys(dictionary); Assert.Zero(dictionary.Count); }
static void OnSceneGUI(SceneView sceneView) { if (s_MouseLabels.Count == 0) { return; } UnityObjectUtils.RemoveDestroyedKeys(s_MouseLabels); Handles.BeginGUI(); var origin = Event.current.mousePosition + k_MouseLabelOffset; foreach (var mouseLabel in s_MouseLabels.Values) { GUI.Label( new Rect(origin + mouseLabel.yOffset * Vector2.up, mouseLabel.boxSize), mouseLabel.message, k_MouseLabelStyle); } Handles.EndGUI(); }