2
2
var WebGlPlugins =
3
3
{
4
4
_LogStartTime : function ( str ) {
5
- var startTimeText = Pointer_stringify ( str ) ;
5
+ var startTimeText = "Missing function" ;
6
6
7
+ if ( typeof UTF8ToString != 'undefined' ) {
8
+ startTimeText = UTF8ToString ( str ) ;
9
+ }
10
+ else if ( typeof Pointer_stringify !== 'undefined' ) {
11
+ startTimeText = Pointer_stringify ( str ) ;
12
+ }
13
+
7
14
if ( typeof unityLoadingFinished !== 'undefined' ) {
8
15
unityLoadingFinished ( startTimeText ) ;
9
16
}
@@ -14,22 +21,42 @@ var WebGlPlugins =
14
21
15
22
_GetTotalMemorySize : function ( )
16
23
{
17
- return TOTAL_MEMORY ;
24
+ if ( typeof TOTAL_MEMORY !== 'undefined' ) {
25
+ return TOTAL_MEMORY ;
26
+ }
27
+
28
+ console . warn ( 'Problem with retrieving unity value. TOTAL_MEMORY: ' + typeof TOTAL_MEMORY ) ;
29
+ return - 1 ;
18
30
} ,
19
31
20
32
_GetTotalStackSize : function ( )
21
33
{
22
- return TOTAL_STACK ;
34
+ if ( typeof TOTAL_STACK !== 'undefined' ) {
35
+ return TOTAL_STACK ;
36
+ }
37
+
38
+ console . warn ( 'Problem with retrieving unity value. TOTAL_STACK: ' + typeof TOTAL_STACK ) ;
39
+ return - 1 ;
23
40
} ,
24
41
25
42
_GetStaticMemorySize : function ( )
26
43
{
27
- return STATICTOP - STATIC_BASE ;
44
+ if ( typeof STATICTOP !== 'undefined' && typeof STATIC_BASE !== 'undefined' ) {
45
+ return STATICTOP - STATIC_BASE ;
46
+ }
47
+
48
+ console . warn ( 'Problem with retrieving unity value. STATICTOP: ' + typeof STATICTOP + ', STATIC_BASE: ' + typeof STATIC_BASE ) ;
49
+ return - 1 ;
28
50
} ,
29
51
30
52
_GetDynamicMemorySize : function ( )
31
53
{
32
- return HEAP32 [ DYNAMICTOP_PTR >> 2 ] - DYNAMIC_BASE ;
54
+ if ( typeof HEAP32 !== 'undefined' && typeof DYNAMICTOP_PTR !== 'undefined' && typeof DYNAMIC_BASE !== 'undefined' ) {
55
+ return HEAP32 [ DYNAMICTOP_PTR >> 2 ] - DYNAMIC_BASE ;
56
+ }
57
+
58
+ console . warn ( 'Problem with retrieving unity value. HEAP32: ' + HEAP32 + ', DYNAMICTOP_PTR: ' + DYNAMICTOP_PTR + ', DYNAMIC_BASE: ' + DYNAMIC_BASE ) ;
59
+ return - 1 ;
33
60
}
34
61
} ;
35
62
0 commit comments