Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

WebGL on iPhone 6+

Discussion in 'Web' started by ArtOfWarfare, Mar 5, 2015.

  1. ArtOfWarfare

    ArtOfWarfare

    Joined:
    Sep 28, 2013
    Posts:
    23
    I'm trying to see what all I can get out of Unity's WebGL compiler on my iPhone 6+.

    The answer is a depressing "not much" (at least, not much so far.)

    I have a very simple scene - one camera, one light, and one cube. The first time I tried, it wouldn't load.

    Second Try Optimizations:
    - Reduced WebGL Memory Size from 256 to 128
    - Changed from No Optimization to Maximum Optimization

    Second Try Results:
    - This reduced the build folder from 150 MB to 30 MB.
    - Loads and shows the cube. The page feels awkward though. The fullscreen button in the lower right corner doesn't seem to do diddly squat when tapped. Can't pinch/spread the page when it's in landscape... maybe because WebGL intercepts the touches? Not sure.

    Next Time I'll Try Optimizations:
    - Set Stripping Level to Strip Byte Code

    Haven't actually tried that yet because I'm on a 2007 iMac. Building even this simple scene takes 10-20 minutes.

    Further Possible Optimizations:
    - The server I'm hosting the files off of is just using whatever version of Apache came with OS X 10.5, and I haven't modified any of the configurations at all. So I suspect that it's not serving up the compressed files.

    What has anyone else tried? What has anyone else managed to irk out of WebGL on an iPhone 6+ (or 6. Or I guess any other mobile device with WebGL?)

    I feel like I might be better off just learning WebGL and manually writing my code in js... I'm not too invested in Unity at this point to swap over.
     
  2. ArtOfWarfare

    ArtOfWarfare

    Joined:
    Sep 28, 2013
    Posts:
    23
    I just checked to see how much quicker my iMac is than my iPhone at loading Build 2:
    - Takes 17 seconds on my iMac (Safari 8.0.3).
    - Takes 22 seconds on my iPhone 6+ (Mobile Safari 8.1.3).

    To ensure consistency in testing times, I clear cached data. Both devices are connecting over my home wifi. The server is hardwired to the router. No other apps are running. The time measured is from when I finish entering the URL until the first frame of my app appears.

    The fact that these times are so close to each other suggests that I shouldn't dismiss Mobile WebGL as a viable target if I'm going to accept Desktop WebGL as a viable target. I will try making further optimizations and also making more complicated projects to see what the limits are for what I can do with WebGL on Mobile.
     
  3. alexusone

    alexusone

    Joined:
    Jan 29, 2014
    Posts:
    28
    how were you able to run webgl on iPhone6+? I have regular 6 and page says that unity curently does not support web gl on mobile platforms?
     
  4. ArtOfWarfare

    ArtOfWarfare

    Joined:
    Sep 28, 2013
    Posts:
    23
    Make the optimizations I mentioned in my post. Note the amount of time it takes to load. Also, hit the OK button when it says it's not supported. Not supported is not the same thing as doesn't work - it's just Unity the company warning you that they make no guarantees that it will work. WebGL takes up a lot of RAM and the iPhone 5, 5S, 6, and 6+ each only have 1 GB. Interestingly, I tried running it on my friend's Galaxy S4 (2 GB RAM) and it actually performed worse on that than my iPhone 6+, so there seems to be more to it than just RAM.
     
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Unity is working on getting the build sizes down with stripping.
     
  6. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,894
    I found http://threejs.org and was amused with some of the games created for WebGL with this library. In fact many of them worked quite well on my iPhone5.
    That's why I maintain my hope that Unity could provide more refined builds.
     
  7. ArtOfWarfare

    ArtOfWarfare

    Joined:
    Sep 28, 2013
    Posts:
    23
    Yeah, I stumbled upon the same thing when I was disappointed with the WebGL build from Unity 5.

    I'm going to keep my project in Unity for now. Worse case scenario, I'll just rewrite it using ThreeJS... I feel like porting it won't be too difficult.
     
  8. lakhbir

    lakhbir

    Joined:
    May 15, 2015
    Posts:
    15
    Hello, Is it possible to webgl play full screen on iPhone with the help of three js. If yes, please let me know steps.