- Home /
Right mouse button in webplayer
How can I use the right mouse button for interactivity in a web player, or get rid of the default right-mouse button context menu?
This came up recently on IRC, I thought it would be useful to have the answer archived here too.
Answer by duck · Dec 02, 2009 at 02:18 PM
This is possible. To do this you need to disable the context menu by editing the webplayer attributes in the HTML, as described here:
http://unity3d.com/support/documentation/Manual/WebPlayerBehaviorTags.html
Note! Be sure to read the bottom paragraph carefully - if you need to make any change, you have to make the same change n a number of different places within the HTML, in order to make it consistent for all browsers/platforms.
Answer by Ashkan_gc · Dec 02, 2009 at 02:45 PM
the unity web player has a property called disableContextMenu. you should set it to true in your HTML file or application. the HTML code is something like this.
if you edit the default HTML generated by unity has different sections for users with javascript enabled or not, you should edit both sections.
Answer by adam michaels · Jan 19, 2010 at 08:09 AM
Here's a follow-on question -- I tried to apply this answer but without good success. You say in these answers "set it to true in your HTML file or application"... and here is my question:
- in the html file generated by unity, there is no instance of the string "disableContextMenu". Are you saying I must add this?
and more importantly....
- HOW DO I DO THIS FROM MY 'APPLICATION'?? (I'd much prefer to do it in code)
Yes, you need to add the property to the html. No, it is not possible to do this from code (though context menus are disabled when you lock the cursor in the web player).
Your answer
Follow this Question
Related Questions
Unity Web Player does not respond to mouse clicks 1 Answer
Erratic mouse Input.GetAxis values on OS X 0 Answers
webplayer problem 1 Answer
Switch Between Touch And Mouse Controls 0 Answers