So when i build to web player with the newest version of unity, after the application is running in my browser,
If I right click within the game, the browser(chrome) pulls up a small context menu “save image, copy image, inspect.”
I can’t figure out how to turn this off, I don’t know what is causing this.
I’m also having trouble with the left click, if you hold down the mouse and move, your cursor will change to one as if you’re typing, or sometimes changes to some kind of “you can’t drag this” feedback symbol which looks like this ( / )
Not sure why this is happening, or how to turn it off???
Just installed the newest version of unity beta 5.6.0b1, never had this issue with version 5.4
This issue should be resolved in the upcoming release.
For now you may use the following workaround. Replace the following code in your index.html:var gameInstance = UnityLoader.instantiate("gameContainer", "Build/your-build.json", {onProgress: UnityProgress});
with this (just make sure you are using appropriate filename for the json):
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/your-build.json", {onProgress: UnityProgress, Module: {
onRuntimeInitialized: function () {
this.canvas.addEventListener("contextmenu", function (e) { e.preventDefault(); });
},
}});
P.S. This workaround is actually a very good example of how you can use the additional UnityLoader.instantiate argument in Unity 5.6. Specifically, adding a Module property to the UnityLoader.instantiate argument lets you override the instantiated Module contents (in this specific case, the onRuntimeInitialized handler). You may use the very same idea to override other Module parameters, like TOTAL_MEMORY etc. directly from the index.html. Note that this keyword in the onRuntimeInitialized function call will be resolved as the instantiated Module object, which has the corresponding canvas as its property. You can also add other initialization code to this handler when necessary.
code which is generated within the [I]index.html [/I]file. Up until right now, I had no clue what was going on.
This [B][I]is [/I][/B]a great example of how to modify the parameters being passed to the game instance. TIL !