File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -138,14 +138,20 @@ const useUnityContext = (unityConfig: IUnityConfig): IUnityContextHook => {
138
138
* Requests the UnityInstance to be unloaded from memory in order to be
139
139
* unmounted from the DOM.
140
140
*/
141
- const unload = useCallback ( ( ) : Promise < void > | undefined => {
142
- if ( unityInstance === null ) {
143
- // Guarding the Unity Instance.
144
- console . warn ( errorMessages . quitNoUnityInstance ) ;
145
- return ;
146
- }
147
- return unityInstance . Quit ( ) ;
148
- } , [ unityInstance ] ) ;
141
+ const unload = useCallback (
142
+ /**
143
+ * @returns A promise that resolves when the UnityInstance has been unloaded.
144
+ */
145
+ ( ) : Promise < void > => {
146
+ if ( unityInstance === null ) {
147
+ // Guarding the Unity Instance.
148
+ console . warn ( errorMessages . quitNoUnityInstance ) ;
149
+ return Promise . reject ( ) ;
150
+ }
151
+ return unityInstance . Quit ( ) ;
152
+ } ,
153
+ [ unityInstance ]
154
+ ) ;
149
155
150
156
// Effect invoked when the loading progression changes. When the loading
151
157
// progression is equal to or more than 1, the Unity Instance is considered
Original file line number Diff line number Diff line change @@ -70,8 +70,9 @@ interface IUnityContextHook extends IEventSystemHook {
70
70
/**
71
71
* Requests the UnityInstance to be unloaded from memory in order to be
72
72
* unmounted from the DOM.
73
+ * @returns A promise that resolves when the UnityInstance has been unloaded.
73
74
*/
74
- readonly unload : ( ) => Promise < void > | undefined ;
75
+ readonly unload : ( ) => Promise < void > ;
75
76
}
76
77
77
78
export type { IUnityContextHook } ;
You can’t perform that action at this time.
0 commit comments