11import { UnityWebglEvent } from './event'
22import { unityLoader } from './loader'
3- import { isBrowser , isObject , omit , queryCanvas } from './utils'
3+ import { isBrowser , isObject , omit , queryCanvas , log } from './utils'
44import { UnityConfig , UnityArguments , UnityInstance } from './types'
55
66type CanvasElementOrString = HTMLCanvasElement | string
@@ -59,7 +59,7 @@ class UnityWebgl extends UnityWebglEvent {
5959 if ( ! isBrowser ) return Promise . resolve ( )
6060
6161 if ( this . _unity && this . _canvas && this . _loader ) {
62- console . warn ( 'Unity instance already created' )
62+ log . warn ( 'Unity instance already created' )
6363 return Promise . resolve ( )
6464 }
6565
@@ -110,7 +110,7 @@ class UnityWebgl extends UnityWebglEvent {
110110 */
111111 sendMessage ( objectName : string , methodName : string , value ?: any ) {
112112 if ( ! this . _unity ) {
113- console . warn ( 'Unable to Send Message while Unity is not Instantiated.' )
113+ log . warn ( 'Unable to Send Message while Unity is not Instantiated.' )
114114 return this
115115 }
116116
@@ -135,7 +135,7 @@ class UnityWebgl extends UnityWebglEvent {
135135 */
136136 requestPointerLock ( ) : void {
137137 if ( ! this . _unity || ! this . _unity . Module . canvas ) {
138- console . warn ( 'Unable to requestPointerLock while Unity is not Instantiated.' )
138+ log . warn ( 'Unable to requestPointerLock while Unity is not Instantiated.' )
139139 return
140140 }
141141 this . _unity . Module . canvas . requestPointerLock ( )
@@ -149,7 +149,7 @@ class UnityWebgl extends UnityWebglEvent {
149149 */
150150 takeScreenshot ( dataType ?: string , quality ?: any ) : string | undefined {
151151 if ( ! this . _unity || ! this . _unity . Module . canvas ) {
152- console . warn ( 'Unable to take Screenshot while Unity is not Instantiated.' )
152+ log . warn ( 'Unable to take Screenshot while Unity is not Instantiated.' )
153153 return
154154 }
155155
@@ -162,7 +162,7 @@ class UnityWebgl extends UnityWebglEvent {
162162 */
163163 setFullscreen ( enabled : boolean ) {
164164 if ( ! this . _unity ) {
165- console . warn ( 'Unable to set Fullscreen while Unity is not Instantiated.' )
165+ log . warn ( 'Unable to set Fullscreen while Unity is not Instantiated.' )
166166 return
167167 }
168168
@@ -174,7 +174,7 @@ class UnityWebgl extends UnityWebglEvent {
174174 */
175175 unload ( ) : Promise < void > {
176176 if ( ! this . _unity ) {
177- console . warn ( 'Unable to Quit Unity while Unity is not Instantiated.' )
177+ log . warn ( 'Unable to Quit Unity while Unity is not Instantiated.' )
178178 return Promise . reject ( )
179179 }
180180 this . emit ( 'beforeUnmount' , this )
@@ -195,7 +195,7 @@ class UnityWebgl extends UnityWebglEvent {
195195 this . emit ( 'unmounted' )
196196 } )
197197 . catch ( ( err ) => {
198- console . error ( 'Unable to Unload Unity' )
198+ log . error ( 'Unable to Unload Unity' )
199199 this . emit ( 'error' , err )
200200 throw err
201201 } )
@@ -211,7 +211,7 @@ class UnityWebgl extends UnityWebglEvent {
211211 unsafe_unload ( ) : Promise < void > {
212212 try {
213213 if ( ! this . _unity || ! this . _unity . Module . canvas ) {
214- console . warn ( 'No Unity Instance found.' )
214+ log . warn ( 'No Unity Instance found.' )
215215 return Promise . reject ( )
216216 }
217217 // Re-attaches the canvas to the body element of the document. This way it
0 commit comments