File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -112,14 +112,16 @@ export class Unity extends PureComponent<IUnityProps, {}> {
112
112
_unityInstanceParameters ,
113
113
this . onProgress . bind ( this )
114
114
) ;
115
+ // Finally pass the instance back to the context object.
116
+ this . unityContext . setUnityInstance ( _unityInstance ) ;
115
117
// Since the creation of the Unity Instance is async, we'll check the
116
118
// component's mount state right aftater instantiating. If the component
117
119
// is no longer mounted, we'll quit the Unity instance right away.
120
+ // This needs to occur after the setUnityInstance call because
121
+ // quitUnityInstance requires the instance to be set.
118
122
// HACK requires type cast to boolean due to await between comparisons.
119
123
if ( ( this . isComponentMounted as boolean ) === false )
120
124
return this . unityContext . quitUnityInstance ( ) ;
121
- // Finally pass the instance back to the context object.
122
- this . unityContext . setUnityInstance ( _unityInstance ) ;
123
125
} catch ( message ) {
124
126
this . unityContext . dispatchEventListener ( "error" , message ) ;
125
127
console . error ( "A problem occurred while mounting" , message ) ;
You can’t perform that action at this time.
0 commit comments