File tree Expand file tree Collapse file tree
org.mixedrealitytoolkit.theming/Theming Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public Theme value
3838 // element, but ChangeEvent<T> is used for its newValue/previousValue semantics
3939 // and object pooling
4040 SetValueWithoutNotify ( value ) ;
41- SendEvent ( changeEvent ) ;
41+ onThemeChanged . Invoke ( changeEvent ) ;
4242 }
4343 }
4444 }
@@ -53,22 +53,17 @@ public void SetValueWithoutNotify(Theme newValue)
5353
5454 public void AddListener ( UnityAction < ChangeEvent < Theme > > action )
5555 {
56+ if ( action == null ) { return ; }
5657 onThemeChanged . AddListener ( action ) ;
58+ if ( activeTheme == null ) { return ; }
5759 using ChangeEvent < Theme > changeEvent = ChangeEvent < Theme > . GetPooled ( null , activeTheme ) ;
58- SendEvent ( changeEvent ) ;
60+ action . Invoke ( changeEvent ) ;
5961 }
6062
6163 public void RemoveListener ( UnityAction < ChangeEvent < Theme > > action )
6264 {
65+ if ( action == null ) { return ; }
6366 onThemeChanged . RemoveListener ( action ) ;
6467 }
65-
66- private void SendEvent ( EventBase e )
67- {
68- if ( e is ChangeEvent < Theme > changeEvent )
69- {
70- onThemeChanged . Invoke ( changeEvent ) ;
71- }
72- }
7368 }
7469}
You can’t perform that action at this time.
0 commit comments