[Tutorial] How does one Unity web player?

edited in Tutorials
Unity (the game engine) has the awesome ability to build games to a web player.

Here's the method I use to share my web builds:

0. Make a game.

1. Build the game for the web. Here's a guide: http://docs.unity3d.com/Documentation/Manual/PublishingBuilds.html

2. Get yourself a Dropbox account. It's free and stupidly useful. https://www.dropbox.com/register

3. Copy the folder that you built your game in to your Public folder in your Dropbox.
EDIT: Public folders aren't enabled by default anymore. To enable them click here.

4. In the folder you just copied over (the one that's now in your Dropbox) right click on the generated html file (called "WebPlayer.html" by default) and click on the Dropbox context menu and then click "Copy public link". This also works from the Dropbox website if you're away from your pc.

5. Now you can give that link to people and they'll be able to play your game :)

Tips:

* When I generate the link I usually run it through a url shortener to make it look nicer. A really awesome shortener to use is https://bitly.com/ because it's free and it also gives you stats on how many times your link got clicked.

* Sometimes your game won't run in Chrome because
the website is being served over SSL but the actual content isn't.
(thanks to @CorruptedHeart for pointing that out). If this happens just instruct your Chrome users to click on the shield icon in the top right hand side of the browser (in the navigation bar) and then click on "Load anyway"

Comments

  • Another "I kinda wished I was using Unity" moment. I'll drop some money into the Game Maker Studio Web Player license sometime. Does anyone know anything about it? I'm a tad apprehensive cos I've read here and there that some code doesn't work in the Web Player, which would mean rebuilding the webplayer build, which is like MEH.
  • This is neat, I really like how you're short-cutting the whole "needing a webserver" thing with Dropbox. Smarts++

    We've been having issues with Chrome and DD recently - textures not loading properly in low-memory situations, crashes when loading savegames off our server, etc. Anybody else getting the same problems, or are we just using Unity in strange ways?
  • I really like the cleverness of using DropBox instead of traditional hosting. I'll have to try that out.
  • @dislekcia Have you tried building a NaCl build instead of a normal web build for chrome?
  • Stray_Train said:
    Have you tried building a NaCl build instead of a normal web build for chrome?
    Yes. It has never been anything other than an unmitigated disaster. For some reason the NaCl build messes up our fonts, so it looks completely different half the time. Then on top of that I can barely get it to load in Chrome... People keep having to turn on NaCl content and all that jazz.

    We're a couple of minor versions of Unity behind at the moment, the plan is to upgrade again this week. Although every time we thing "maybe the NaCl stuff is good now" it keeps producing something I wouldn't want to let our players near.
  • Thanks a bunch for this :)
  • NaCl build
    ...Sodium Chloride...? Salt???
    Thanked by 2Bensonance D3zmodos
  • @Tuism weird that didn't cross my mind when I typed it :P NaCl = native client

    @dislekcia do you guys use of the built in gui system? I read that eats up a lot of memory. As for loading crashes dafuq? All this happens just in chrome?
  • @Stray_Train: Yeah, all happening in Chrome. FF doesn't have any of these issues... Apparently some happen in IE at some point, maybe, but tbh the actual reporting of those errors hasn't given me a lot of information and, well, fuck IE.

    We only use the built-in UI stuff in a couple of places to get input from the player. The login box is pretty much it, everything else is custom. One of the things that DD does differently to most Unity games is load build meshes and load textures on the fly. We're not prefabbing anything (once we got to the point of possibly needing prefabs, we already had the whole random generation stuff in, so it was just easier) and that seems to be a major source of the problems. Maybe Chrome gives you the memory you ask for at appstart and then no more?
  • @dislekcia, Oh I've actually heard of something like this before. Where too little memory is assigned. It seems like a rather "wasteful" activity, but is there any way you could try and add empty objects or something of the like, then free it as the game loads? This might make the loading time a bit longer though, but perhaps it won't even be noticeable.

    Either way, it's a bit hacky, and I don't like this idea :P
  • Well, I could always go the oldschool approach and assign a pool of memory and then create new objects inside that pool and do my own memory management, but then I'd have serious problems getting Unity to play nice with that. I'm hoping that there's a simpler, Unity-mediated solution here. It's supposed to be a managed setup, after all.
  • @Stray_Train Thanks for the neato post! Using it right now.
  • edited
    Slight majour problem: the build of my game works fine, but when I use the link to the WebPlayer.html it just loads a page of html code. Dont know if it's maybe just my pc doing this. Maybe I'm doing something incorrectly? Any Ideas?
  • edited
    @notSimon207, Two things you can check maybe(not sure if it will help though), make sure that both the files generated by Unity are in the same folder when copying them to dropbox. And don't check any of the boxes when doing the build in Unity. That's whats working for me anyways.
  • @notsimon207 it loads a page of html code when the file isn't in your Public folder (Public is a folder in the root of your Dropbox folder). I have no idea why this is :/
  • Why don't I have a public folder?

    It seems that everyone here is using it, but according to a Google search, Dropbox no longer support Public folders.

    Am I insane?
  • @Yay dropbox still has public folders. I just looked and mine exists.
  • YayYay
    edited
    "Please note: New Dropbox accounts created after October 4, 2012 no longer have a Public folder."

    Link
  • @Yay,

    from the dropbox website:
    Dropbox said:
    Please note: New Dropbox accounts created after October 4, 2012 no longer have a Public folder. Don't worry! Every account created prior to this date will still have a Public folder. If you would like to enable a Public folder on a new account, see the instructions below (Creating a Public folder).

    However, all the extra functionality provided by the Public folder is now accessible anywhere in your Dropbox. Now all you need to do to share and preview files and folders in your Dropbox is select Share link via your computers, phones, and tablets.
  • YayYay
    edited
    This change seems to make it not work. If you use the "Share Link" button, it takes you to a page of HTML. If you access the HTML directly from DropBox, it takes you to a page with an Error 403:

    "It seems you don't belong here! You should probably sign in. Check out our Help Center and forums for help, or head back to home. "

    It seems that loading the HTML in Chrome, it prompts you to download Unity Web player, even though it is already installed, even with that trick of changing the HTML source in the header.
  • edited
    There seems to be a way you can still activate a public folder on your account. It's about halfway down the page that has the info I posted(which I think you linked, but is gone now.) Maybe you can try that?
  • YayYay
    edited
    You are absolutely right.

    You can activate the Public Folder here

    Just to clarify if anybody is having the same problems. The files HAVE to be in the public folder. If you created your Dropbox account after 4 October, you will need to activate it first using the above link and everything should work fine.
  • Thanks for the fix guys!
  • edited
    am I just being a noob or something :S I've placed some files in my public folder:
    .html
    .unity3d
    tried that and didn't work online but in my computers dropbox directory it works, online it doesn't load.
    tried putting some other files in there too.
    temp folder from the unity project that was created at the same time as the .html and .unity3d files, no cigar, similarly with the application file.
    Anyone got some tips for me, would love to get a web build of my prototype to the forums, since I'm moving on the 31st, which also happens to be the meet up date! Hoping to still attend though.
    Thanks in advance.
    Thanked by 1Yay
  • YayYay
    edited
    Perhaps link to the HTML in your public Dropbox folder so that we can see.

    Edit: What does hearting mean? It's adorable.
  • edited
    O.O wow, for some reason it's working :S :)
    well I guess I'll make another [url = http://makegamessa.com/discussion/290/prototype-blockboy#Item_1]thread for this[/url] then haha :) Thanks @Yay!
  • That link works for me. :-) (I'm on my phone so can't actually play, but I do see the Unity plug in placeholder.)
  • edited
    Sorry for the bad Necro-Post, however I would like to just let people know this also works 100% for Game Maker Studio HTML 5 builds. (Evidence!)

    Edit: Also added to the wiki (so that it has a permanent easy to find residence :) - http://makegamessa.com/wiki/index.php?title=HTML_5 )
    Thanked by 2Tuism creative630
  • Awesome, we need more of this wiki migration of info :)
    Thanked by 1[Deleted User]
Sign In or Register to comment.