Spent a while working on something, it works, but thanks to a "quirk" in Unity I get to start over.

So I built a high score system that pulls the high scores of a database and all that, displays it, etc.
Then I go to deploy to the web player and I’m met with “Not Supported!” I find out that Unity web player doesn’t support the web client. I google further and find “you’ll have to write your own using tcp-ip” or something like that. Today I was trying to take JSON and turn it into objects and arrays and only to find that the best way is through Newtonsoft’s Json.NET, but not really per se because Json.NET has actually had several major releases beyond what I was able to get working within Mono… so it’s really a matter of using deprecated code to transmogrify strings into objects through some kind of generic monstrosity that frankly scares the bejeesus out of me. It was cleaner to just rewrite the server and cut out the JSON altogether.

I guess my biggest gripe is that… obviously I can write my own blank from scratch, or pay somebody to write it for me. Obviously I can download blank and use that library… but why should I even have to? I shouldn’t have to fight uphill, scouring documentation just to do little things like get the text content from an http request, and then do it only to find out that it’s kind of not supported, sort of. Maybe I’m just spoiled from writing code that works in systems that aren’t riddled with deprecation and lack-of-support landmines. Honestly makes me averse to trying anything else. Who knows what will spring up and cut my knees out from under me, then I’ll google it and find out that oh… there’s a post from 2009 where somebody had this same issue. Unfortunately, you’d have to have this issue to know what to google… so it’s a bit of a conundrum.

Ultimately, I think things work best when they work as expected.

But the biggest issue is just the time. Who has the time to just constantly discover bugs and quirks and find clever ways to work around them?

So now I’ll probably just create a web page for the high scores. You know… a little good old PHP in a web browser.

Doing the “impossible”… with notepad.

by “quirk” do you mean the whole web player security stuff?

http://docs.unity3d.com/Manual/SecuritySandbox.html

No.

As proof, I got it to work with the WWW class in the web player. Post high score, server-side save to database, get sorted high scores in string format with delimiters, parse, populate text field.

WebClient seems useless by comparison. It should have a warning label: “Do not use.”

Well, you could use my port of JSON .NET which would solve those issues. There are also several free JSON libraries that may work with WebPlayer such as JsonFX, miniJSON or JsonObject.

As for WWW, it is supported just fine in WebPlayer but is restricted to domain of origin (same domain) unless you properly setup your crossdomain.xml file to allow access from another origin. That xml file needs to be in the root of the domain you’re trying to access via WWW.

1 Like

This.

To the OP - instead of getting all OMGTHISISNTWORKOMGUNITYSUCKS … Why don’t you RTFM first and then if you have issues, ask constructively for help? Moaning gets you nowhere.

At least I’m working on something.

Thanks for the replies.

If my games require JSON in the future, I’ll check out your suggestions. For now, I am content with just pushing strings back and forth with delimiters. We’ll see.

1 Like