ghgfhj
February 18, 2023, 11:39pm
1
I am aware of the following statement at the official Unity WebGL documentation, but still wonder about it:
“Unity WebGL doesn’t support mobile devices. It might work on high-end devices, but current devices are often not powerful enough and don’t have enough memory to support Unity WebGL content.”
This statement appeared in the documentation of Unity 5.3 (and is still there in Unity 2023), and I’m sure that browsers and mobile devices evolved a lot during these ~8 years.
But, I see that some games (made in Unity WebGL) do work properly in (various) browsers on android and iOS.
My app (I’m using the devices camera and ML modules) works well on old Android devices (4 years old) but doesn’t work on newer Android devices and the newest iPhones, and iPads at all.
1. How come old android phones are „more powerful“ than the latest iOS devices?
2. Are there any specific known limitations (packages) that couldn’t work on some mobile devices?
3. Does Unity plan to officially support WebGL on mobile devices in the future?
2 Likes
Maybe its cause of this? Unity WebGL poor rendering performance on iOS 16.x safari
To answer your questions:
That looks like a short-sighted assumption. It is nothing like that.
Yes, mainly multithreading, its simply not supported by javascript language.
Yes, they already have started. I’m not sure why are you reading the documentation of Unity 5.3, its completely outdated information!
1 Like
DevDunk
February 20, 2023, 11:20am
3
1 Like
Those device are not „more powerful“ just because newer Apple devices won‘t run the app. It just tells you that you have a broken iOS build and you need to debug what the cause of that is. Check console logs. It may be an incompatibility with Safari/Webkit, a violation of terms enforced by iOS, trying to use a feature that is not or no longer supported on iOS.
why can’t unity use an established framework like three or babylon to export webgl content? or, barring that, create a web-native framework for its player?
the capabilities and limitations seem about the same with unity’s webgl player, but they DO work on mobile, and are quite performant too.
Unity’s problem with WebGL builds seem to lie mainly in the player itself.
I’d like to find out what people think about this.
The reason is because we’re offering people the capabilities of the Unity engine, which can do a lot , and we’re converting that to something that can run in a web browser. That has a cost, of course. It works for some use cases, but not others, which would benefit from using something like three.js and such.
1 Like
I tested with Unity 2022.3.7, iPhone XS Max, Samsung Galaxy A71. WebGL works.
Moreover, the New Input System declares here that sensor (accelerometer, gyro, etc.) support for WebGL on Android and iOS devices is available in Unity 2021.2.
So it works, and I recorded a video tutorial about building and testing for Mobile WebGL.
> Complete Article with all Links and Commands <
4 Likes
Hey there,
I was trying to get the URP sample running on the mobile webGL. Everything works fine except the device type. The scene does this in code
if (SystemInfo.deviceType == DeviceType.Handheld)
{
m_TouchInputCanvas.SetActive(true);
}
This is fine on web since its keyboard controls. But for mobile there is a dedicated touch control UI which is not getting activated from the above code. Is this the same mechanism to identify device type on a mobile browser? I mean will this differentiate a browser as it is on a desktop OR mobile?
ashfaqueck:
Hey there,
I was trying to get the URP sample running on the mobile webGL. Everything works fine except the device type. The scene does this in code
if (SystemInfo.deviceType == DeviceType.Handheld)
{
m_TouchInputCanvas.SetActive(true);
}
This is fine on web since its keyboard controls. But for mobile there is a dedicated touch control UI which is not getting activated from the above code. Is this the same mechanism to identify device type on a mobile browser? I mean will this differentiate a browser as it is on a desktop OR mobile?
There was an issue with this or with compiler directives, I don’t remember exactly, but I found a solution such way. In my Sensor Camera (Unity Asset) I use the next boolean flags:
isWebGLOnDesktop = !Application.isMobilePlatform
&& Application.platform == RuntimePlatform.WebGLPlayer;
isWebGLOnMobile = Application.isMobilePlatform
&& Application.platform == RuntimePlatform.WebGLPlayer;
1 Like
makaka-org:
There was an issue with this or with compiler directives, I don’t remember exactly, but I found a solution such way. In my Sensor Camera (Unity Asset) I use the next boolean flags:
isWebGLOnDesktop = !Application.isMobilePlatform
&& Application.platform == RuntimePlatform.WebGLPlayer;
isWebGLOnMobile = Application.isMobilePlatform
&& Application.platform == RuntimePlatform.WebGLPlayer;
Thanks for the response buddy.
BTW I solved it by getting back that info from the browser end using jslib communication.
I used this function there on the jslib file
isHandHeldDevice: function () {
if (navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)) {
return true ;
} else {
return false ;
}
},
Now I have it working with appropriate platform specific controls.
Here is the next thing we need to do for the new webGL builds from 6.
A responsive template for the latest webgl builds.
Anyone got one?
NB: This wont work now.
1 Like
Here is the workaround for responsive screen: in russian, but you will understand that.
That helped. Thanks buddy. Will host it somewhere soon and let you know.
The build runs fine on android. But not on iOS,
Are there some limitation for unity WebGL on iphone?
Device : iphone 14
Cache disabled
Uncompressed
ASTC Texture compression
Attached is the log. After this the unity loaded restarts. Literally the progress bar starts again from beginning. After some attempts it shows “Can’t open this page”
@unityruba @makaka-org
ERROR still waiting on run dependencies:
ERROR dependency: wasm-instantiate
ERROR (end of list)
ERROR still waiting on run dependencies:
ERROR dependency: dataUrl
ERROR (end of list)
LOG[UnityMemory] Configuration Parameters - Can be set up in boot.config
LOG "memorysetup-allocator-temp-initial-block-size-main=262144"
LOG "memorysetup-allocator-temp-initial-block-size-worker=262144"
LOG "memorysetup-temp-allocator-size-audio-worker=65536"
LOG "memorysetup-temp-allocator-size-background-worker=32768"
LOG "memorysetup-bucket-allocator-granularity=16"
LOG "memorysetup-bucket-allocator-bucket-count=8"
LOG "memorysetup-bucket-allocator-block-size=4194304"
LOG "memorysetup-bucket-allocator-block-count=1"
LOG "memorysetup-main-allocator-block-size=16777216"
LOG "memorysetup-thread-allocator-block-size=16777216"
LOG "memorysetup-gfx-main-allocator-block-size=16777216"
LOG "memorysetup-gfx-thread-allocator-block-size=16777216"
LOG "memorysetup-cache-allocator-block-size=4194304"
LOG "memorysetup-typetree-allocator-block-size=2097152"
LOG "memorysetup-profiler-bucket-allocator-granularity=16"
LOG "memorysetup-profiler-bucket-allocator-bucket-count=8"
LOG "memorysetup-profiler-bucket-allocator-block-size=4194304"
LOG "memorysetup-profiler-bucket-allocator-block-count=1"
LOG "memorysetup-profiler-allocator-block-size=16777216"
LOG "memorysetup-profiler-editor-allocator-block-size=1048576"
LOG "memorysetup-temp-allocator-size-main=4194304"
LOG "memorysetup-job-temp-allocator-block-size=2097152"
LOG "memorysetup-job-temp-allocator-block-size-background=1048576"
LOG "memorysetup-job-temp-allocator-reduction-small-platforms=262144"
LOGLoading player data from data.unity3d
LOGInitialize engine version: 6000.0.0f1 (4ff56b3ea44c)
LOG[Subsystems] Discovering subsystems at path UnitySubsystems
LOGCreating WebGL 2.0 context.
LOGRenderer: WebKit WebGL
LOGVendor: WebKit
LOGVersion: OpenGL ES 3.0 (WebGL 2.0)
LOGGLES: 3
LOG EXT_clip_control EXT_color_buffer_float EXT_color_buffer_half_float EXT_depth_clamp EXT_polygon_offset_clamp EXT_texture_filter_anisotropic EXT_texture_norm16 KHR_parallel_shader_compile OES_draw_buffers_indexed WEBGL_clip_cull_distance WEBGL_compressed_texture_astc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_pvrtc WEBKIT_WEBGL_compressed_texture_pvrtc WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context WEBGL_multi_draw WEBGL_polygon_mode WEBGL_provoking_vertex GL_EXT_clip_control GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_depth_clamp GL_EXT_polygon_offset_clamp GL_EXT_texture_filter_anisotropic GL_EXT_texture_norm16 GL_KHR_parallel_shader_compile GL_OES_draw_buffers_indexed GL_WEBGL_clip_cull_distance GL_WEBGL_compressed_texture_astc GL_WEBGL_compressed_texture_etc GL_WEBGL_compressed_texture_etc1 GL_WEBGL_compressed_texture_pvrtc GL_WEBKIT_WEBGL_compressed_texture_pvrtc GL_WEBGL_debug_renderer_info GL_WEBGL_debug_shaders GL_WEBGL_lo
LOGse_context GL_WEBGL_multi_draw GL_WEBGL_polygon_mode GL_WEBGL_provoking_vertex
LOGOPENGL LOG: Creating OpenGL ES 3.0 graphics device ; Context level <OpenGL ES 3.0> ; Context handle 1
LOG[PhysX] Initialized SinglethreadedTaskDispatcher.
LOGERROR: Shader
LOGHidden/CoreSRP/CoreCopy shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
LOGERROR: Shader
LOGHidden/VoxelizeShader shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
LOGERROR: Shader
LOGHidden/Universal Render Pipeline/Edge Adaptive Spatial Upsampling shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
LOGERROR: Shader
LOGHidden/Universal/HDRDebugView shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
LOGInput Manager initialize...
LOGInput System initialize...
LOGNew input system (experimental) initialized
ashfaqueck:
The build runs fine on android. But not on iOS,
Are there some limitation for unity WebGL on iphone?
Device : iphone 14
Cache disabled
Uncompressed
ASTC Texture compression
Attached is the log. After this the unity loaded restarts. Literally the progress bar starts again from beginning. After some attempts it shows “Can’t open this page”
@unityruba @makaka-org
ERROR still waiting on run dependencies:
ERROR dependency: wasm-instantiate
ERROR (end of list)
ERROR still waiting on run dependencies:
ERROR dependency: dataUrl
ERROR (end of list)
LOG[UnityMemory] Configuration Parameters - Can be set up in boot.config
LOG "memorysetup-allocator-temp-initial-block-size-main=262144"
LOG "memorysetup-allocator-temp-initial-block-size-worker=262144"
LOG "memorysetup-temp-allocator-size-audio-worker=65536"
LOG "memorysetup-temp-allocator-size-background-worker=32768"
LOG "memorysetup-bucket-allocator-granularity=16"
LOG "memorysetup-bucket-allocator-bucket-count=8"
LOG "memorysetup-bucket-allocator-block-size=4194304"
LOG "memorysetup-bucket-allocator-block-count=1"
LOG "memorysetup-main-allocator-block-size=16777216"
LOG "memorysetup-thread-allocator-block-size=16777216"
LOG "memorysetup-gfx-main-allocator-block-size=16777216"
LOG "memorysetup-gfx-thread-allocator-block-size=16777216"
LOG "memorysetup-cache-allocator-block-size=4194304"
LOG "memorysetup-typetree-allocator-block-size=2097152"
LOG "memorysetup-profiler-bucket-allocator-granularity=16"
LOG "memorysetup-profiler-bucket-allocator-bucket-count=8"
LOG "memorysetup-profiler-bucket-allocator-block-size=4194304"
LOG "memorysetup-profiler-bucket-allocator-block-count=1"
LOG "memorysetup-profiler-allocator-block-size=16777216"
LOG "memorysetup-profiler-editor-allocator-block-size=1048576"
LOG "memorysetup-temp-allocator-size-main=4194304"
LOG "memorysetup-job-temp-allocator-block-size=2097152"
LOG "memorysetup-job-temp-allocator-block-size-background=1048576"
LOG "memorysetup-job-temp-allocator-reduction-small-platforms=262144"
LOGLoading player data from data.unity3d
LOGInitialize engine version: 6000.0.0f1 (4ff56b3ea44c)
LOG[Subsystems] Discovering subsystems at path UnitySubsystems
LOGCreating WebGL 2.0 context.
LOGRenderer: WebKit WebGL
LOGVendor: WebKit
LOGVersion: OpenGL ES 3.0 (WebGL 2.0)
LOGGLES: 3
LOG EXT_clip_control EXT_color_buffer_float EXT_color_buffer_half_float EXT_depth_clamp EXT_polygon_offset_clamp EXT_texture_filter_anisotropic EXT_texture_norm16 KHR_parallel_shader_compile OES_draw_buffers_indexed WEBGL_clip_cull_distance WEBGL_compressed_texture_astc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_pvrtc WEBKIT_WEBGL_compressed_texture_pvrtc WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context WEBGL_multi_draw WEBGL_polygon_mode WEBGL_provoking_vertex GL_EXT_clip_control GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_depth_clamp GL_EXT_polygon_offset_clamp GL_EXT_texture_filter_anisotropic GL_EXT_texture_norm16 GL_KHR_parallel_shader_compile GL_OES_draw_buffers_indexed GL_WEBGL_clip_cull_distance GL_WEBGL_compressed_texture_astc GL_WEBGL_compressed_texture_etc GL_WEBGL_compressed_texture_etc1 GL_WEBGL_compressed_texture_pvrtc GL_WEBKIT_WEBGL_compressed_texture_pvrtc GL_WEBGL_debug_renderer_info GL_WEBGL_debug_shaders GL_WEBGL_lo
LOGse_context GL_WEBGL_multi_draw GL_WEBGL_polygon_mode GL_WEBGL_provoking_vertex
LOGOPENGL LOG: Creating OpenGL ES 3.0 graphics device ; Context level <OpenGL ES 3.0> ; Context handle 1
LOG[PhysX] Initialized SinglethreadedTaskDispatcher.
LOGERROR: Shader
LOGHidden/CoreSRP/CoreCopy shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
LOGERROR: Shader
LOGHidden/VoxelizeShader shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
LOGERROR: Shader
LOGHidden/Universal Render Pipeline/Edge Adaptive Spatial Upsampling shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
LOGERROR: Shader
LOGHidden/Universal/HDRDebugView shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
LOGInput Manager initialize...
LOGInput System initialize...
LOGNew input system (experimental) initialized
I tried URP with WebGL in FPS Shooter , never saw such errors. No custom shaders for Non-AR version are here. I used this guide and this guide when migrating from BRP to URP. Try to replace indicated shaders in your log or upgrade them with this Unity converter .
But the shader errors are fine I think. The issue is
ERROR still waiting on run dependencies:
ERROR dependency: wasm-instantiate
ERROR (end of list)
ERROR still waiting on run dependencies:
ERROR dependency: dataUrl
ERROR (end of list)