|
metadata
Not to necro an old post, but if anyone is interested in me writing an updated tutorial for Unity 2018.1+ I can do that, showing how I got it to work with Kong's API using the new Unity jslib system, rather than the deprecated ExternalCall/Eval methods. It produces a cleaner code, and is very straightfoward and easy to understand. (Again if no one is interested, sorry for necroing a 2 year old post).
|
|
|
metadata
Sokuaisushi, I'm very interested! Please do :)
|
|
|
metadata
sokuaishusi im very interested!
|
|
|
metadata
Sokuaisushi, I'm also interested!
|
|
|
metadata
Tip: Another catch I had to deal with, using unity 2017, was, that I was getting 404 file not found error after the upload, even though I followed the tutorial steps to the letter. The fix for it was, that I had to rename the kongregate_shell.html to index.html when uploading.
Possibly a new bug/glitch with the automatic kongregate backend renamer.
|
|
|
metadata
Well at some point I got this working. The High Score statistic I was trying to submit is still not work using. Application.ExternalCall("parent.kongregate.stats.submit","High Score",Totalscore); But even before that, when I tried uploading the kongregate_shell, I got the "Kongbot couldn't find the game you're looking for" error. So I tried renaming it to index.html as suggested (as I'm using Unity 2017.31f1). This worked once...but every build after that I get this error "An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data". I've been at this for three days now reading multiple guides and watching youtube videos and simply can not get this to work.
|
|
|
metadata
To anyone trying to use Application.ExternalCall in the future: Don't. It's being deprecated.
Use the [.jslib functionalty](https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html) instead.
Here's an example with downloads to get started with the API: https://www.kongregate.com/forums/1021798-game-programming-subforum/topics/1673115-guide-kong-api-with-unity-jslib-system
|
|
|
metadata
> This is a guide for people having trouble getting kongregate’s API to work with a Unity WebGL build. If you're just looking for a guide on uploading WebGL games without the API have a look at this one [http://developers.kongregate.com/blog/unity-](http://developers.kongregate.com/blog/unity-webgl)[webgl](https://begamedev.com)
>
> Step 1
> Download the simple HTML shell from kongregate’s blog
>
> Step 2
> In your code when you want to submit a stat use
>
> Application.ExternalCall("parent.kongregate.stats.submit","MyStatName",myScore );
>
> where "MyStatName" is the name of the statistic you set when uploading your game to kongregate and myScore is the variable you want to submit.
>
> Step 3 (Optional)
> If you want a loading bar, you can head over here for a pretty nice kongregate template :)
>
> There's instructions for how to set it up over there.
Hey this is great tutorial, but as much as I love Unity and it's my favorite game engine, dont u think javascript browser games are better? much less bloated, and for browser games, performance counts a lot
|
|
|
metadata
I wouldn't deal with JS browser games. Maybe I'm wrong btu nevertheless I can't find any cons for this.
|
|
|
metadata
Is there a functional, easy and up to date tutorial about how to send values between Unity WebGL games and Kongregate?
All the existing examples seem to be deprecated and I cant get them to work.
Would be nice to send the highscore from my games to Kong.
[https://www.kongregate.com/games/Kjelle69]
|
|
|
metadata
Hi , is there a similar thing for Godot ?
|
|
|
metadata
I'm having trouble locating the correct sections of index.html for section 7.
`<script src="Build/UnityLoader.js"></script>
There doesn't seem to be *any* reference to the UnityLoader.js file. UnityLoader.instatiate isn't in the script either.
`UnityLoader.instantiate("gameContainer", "Build/Builds.json")
I can tell that there are differences between the build in the gif and the 2019.4 build that I have. Trying to find the differences is difficult because it's a gif. If it were a video, I could at least pause it. Did something change in the 2019 version?
|
|
|
metadata
> *Originally posted by **[senshisun](/forums/1021798/topics/614955?page=2#13413952)**:*
> I'm having trouble locating the correct sections of index.html for section 7.
> `<script src="Build/UnityLoader.js"></script>
> There doesn't seem to be *any* reference to the UnityLoader.js file. UnityLoader.instatiate isn't in the script either.
> `UnityLoader.instantiate("gameContainer", "Build/Builds.json")
> I can tell that there are differences between the build in the gif and the 2019.4 build that I have. Trying to find the differences is difficult because it's a gif. If it were a video, I could at least pause it. Did something change in the 2019 version?
I think in the updated version of the Kong Preloader, it's already done for you. I was able to build and publish without changing anything.
|