Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Making Web Sites using Unity 5.0 WebGL

Discussion in 'General Discussion' started by JesOb, May 23, 2014.

  1. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,081
    I want to use Unity 5.0 WebGL to create site for game.

    Pros:
    - I can use .Net C# for site coding
    - I can test and debug site inside Unity editor using Visual Studio
    - site can have 3D elements

    Cons:
    - site can have big loading time because of I think around 10Mb of engine code translated to asm.js

    How you think about it?
    Can Unity WebGL become new .Net/C# web development platform?
     
  2. Teo

    Teo

    Joined:
    Oct 31, 2009
    Posts:
    564
    For websites, I think is not a good idea to enable WebGL at all, just because maybe do not everybody got WebGL support. ( not counting the loading time at all)

    For browser games, WebGL will be the future. But not only Unity is doing WebGL, there are a lot of middle-ware doing that or focused only on that. Take a look at Turbulenz Engine (totally free and opensource) for example, they do pure javascript with typescript support, asm.js is just a file, probable you talk about emscripten, and thats other story. Emscripten generates javascript from C/C++. (there are other tools also who can generate javascript from various languages)
     
    Wapps likes this.
  3. DallonF

    DallonF

    Joined:
    Nov 12, 2009
    Posts:
    620
    As a web developer, let me just say...

    NO NO NO PLEASE NO

    DON'T DO THIS

    1. Remember the last time you saw a website made entirely in Flash? It was awful, right? This is what happens when you try to make websites with multimedia tools.
    2. You get no SEO out of the deal. Believe me, in this world, you need SEO
    3. It will only work on the absolute latest browsers. Want to reach ~30% of the world still using some version of Internet Explorer? Or whatever ungodly percentage are looking at your site on a mobile device? Forget about WebGL.
    4. Sticking with one tool in all situations simply because already you know it is generally a bad idea, because there's almost always a better tool available. Real programmers use the best tool for the job, even if they have to learn it first!

    As for the potential advantages you mention, they are completely possible in the normal HTML/CSS/JavaScript stack without trying to stretch a game engine to build a website:
    1. There's lots of tools that will translate C# into JavaScript: Script#, JSIL, and SharpKit are just a few. In addition, there's TypeScript, which is sort of the lovechild of C# and JavaScript.
    2. The modern Web workflow is actually significantly better than Unity's. If you set it up right, you can see immediately your changes in the browser as you're typing, or at least every time you save. I wish Visual Studio's debugger was more like Chrome's. If you really still want to use Visual Studio, though, the TypeScript plugin for Visual Studio will let you debug there as well.
    3. I'm just gonna leave this here.
     
  4. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    As for the question if using Unity to design your web page makes sense, people have given some valid reasons against it, though i guess the answer depends on what your web page is. If your web page is "just" a game, then it is a no brainer.

    Anyways, I'd chime in on this one:

    10 MB is probably a bit on the high side. The exact size of the code depends on your project and your scripts, but here's some code sizes from stuff we've tried (sizes are for gzip compressed js):

    Dead Trigger 2 Demo: 6.9 MB
    AngryBots: 3.8 MB
    Simple "Flappy Bird" style game: 2.4MB

    (These sizes reflect JavaScript code only, not assets)
     
    Last edited: May 23, 2014
  5. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    I'll be making my website in it I'm 73.333 percent sure, though it will be a interactive game website not like a normal website.
     
  6. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
  7. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    If you don't want organic search traffic and you can get traffic other ways (e.g. video, article sites, social sharing etc) then it may be okay to not worry about the organic part.
     
  8. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,065
    You'd probably want fallback pages. Would it be difficult to redirect the search engines to them as well?
     
  9. Kend

    Kend

    Joined:
    Apr 6, 2014
    Posts:
    17
    use web frameworks for webs and game engines for games and you will be happy.
     
  10. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Can't say Unity is only meant to be a "game" engine. It can do a lot more than that :)
     
  11. DallonF

    DallonF

    Joined:
    Nov 12, 2009
    Posts:
    620
    With enough effort, Unity can make pretty much anything. But then again, with enough effort, I can use a screwdriver to pound in a nail. Learn to use the right tool for the right job.

    The WebGL export will be fantastic for highly interactive 3D content in the browser. Imagine you're on an ecommerce site, and instead of an image of a product, you see a full rotating 3D model. Although maybe Unity would be a bit overkill for that? A basic understanding of Three.js (which is open source by the way) would get you the same result. I'm just rambling now, sorry, I'm gonna go away.
     
  12. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    I would say the 'using a screwdriver to pound a nail' analogy is a false one. After all, I was making the argument that Unity could be the 'right tool' for that job.

    "could", anyway... I'm not saying that it would be the best tool for any website type out there, of course. I'm just saying that just because it's a "game" engine doesn't mean it can't be used for other things.
     
  13. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    What about making a web page VR ready, so if someone logs onto your site using a VR headset they enter a Virtual Space? Wouldn't this take a game engine level toolset to produce a good effect?

    Note with WebGL and VR HMD detection this is just around the corner, if someone has not already done it.
     
    Last edited: May 24, 2014
  14. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    Once Unity WebGL is out, would a website made with WebGL still be as awesome? I wonder if it will start popping up everywhere... a few months ago I was looking into WebGL for a website but never got in to it much, but I'd do it in Unity (Just cause then there's no learning curve)
     
  15. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    There are a number of WebGL game engines popping up but what I found more interesting was the need for a 3D web standard. For example it takes a lot of code to get a simple cube to appear, what if you could just write a line of standard 3DHTML to display a 3D cube or object?
     
  16. charmandermon

    charmandermon

    Joined:
    Dec 4, 2011
    Posts:
    352
    WebGL is web 3.0

    You can bet your bottom dollar that I will be making websites with unity. Such an amazing competitive advantage to integrate your game and designs with .net web services and database connections all wrapped in an unlimited 3d interface....This is the future.
     
    yurak0901 likes this.
  17. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    782
    Just as a portfolio piece it would be worthwhile doing. However, most large website design companies made full flash websites to show what they could do and to enter awards. An award would bring in business, a good flash site showcasing design skills etc would help as well. The fact that once a customer had signed up most professional web companies would then recommend against using flash and talk about clean design principals does not negate the obvious selling potential of flash for these service companies.
     
  18. daviddickball

    daviddickball

    Joined:
    May 26, 2014
    Posts:
    10
    3 years have passed. I want to know if charmandermon is actually making websites in Unity?
     
  19. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,784
    When Building a website... Notepad > Unity.
    When building a game... Unity > Notepad.
     
    Martin_H likes this.
  20. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,789
    I have used Unity daily for the past year and am not making games.
     
  21. grimunk

    grimunk

    Joined:
    Oct 3, 2014
    Posts:
    270
    We are running an online multiplayer game called kazap.io. The entire runtime, when gzipped, is about 8 MB.

    A lot of bandwidth could be saved if there was a runtime that was hosted for everyone to use, however it would probably end up being larger due to no code stripping.
     
  22. nomax5

    nomax5

    Joined:
    Jan 27, 2011
    Posts:
    365
    I like the idea of webgl websites I'm going to have a fiddle.
    I read the posts above and SEO is an old and obsolete idea IMHO
    The google algorythm changes more than twice a day, if you are ranking well in a morning you can't guarentee you will be in the afternoon. Unless you pay google ofcourse then you can rank where ever you like.
     
  23. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,714
    Your opinion is... uh... wrong, I guess? Literally everyone is constantly making sure to adjust SEO concepts due to algorithmic changes all the time and webGL sites still fail every single modern metric.

    This isn't true in any realistic terms at all.
     
  24. unity_WGNMltOdHttvWQ

    unity_WGNMltOdHttvWQ

    Joined:
    Nov 18, 2017
    Posts:
    3
    I think HTML5 is really the way to go for web development/games online. Flash sucks webgl is meh...