Unity Web Player - GAE

I have a problem with hosting my Unity3d web application on GAE. When the application loads and the web player starts to request the “.unity3d” file, i use the following python script to make the HTTP response:

class UnityHandler(webapp.RequestHandler):
  def get (self, q):
    if q is None:
      q = 'WebPlayer.unity3d'

path = os.path.join (os.path.dirname (__file__), q)
self.response.headers ['Content-Type'] = 'text/html'
self.response.out.write (template.render (path, {}))

def main ():
  application = webapp.WSGIApplication (
    [('/(.*html)?', MainHandler), 
    ('/(.*unity3d)?', UnityHandler)
    ], debug=True)
 util.run_wsgi_app (application)

It doesn’t work quite well, it finds the file but the Unity web player give me a “bad file length” error.

So can anyone tell me where the problem is ? I think it has something to do with setting the “Content-type”, but i don know how to fix it ?


Samer Samy

Maybe the MIME type is not allowed on the server configuration.

Try to rename the .unity3d file to “.txt” and replace the extension in the HTML too.
If it works, then you need to add the “.unity3d” file extension to your “MIME Type” list on the server.