x


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.

more ▼

asked Dec 02 '09 at 02:17 PM

duck gravatar image

duck ♦♦
41k 92 148 415

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

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.

more ▼

answered Dec 02 '09 at 02:18 PM

duck gravatar image

duck ♦♦
41k 92 148 415

(comments are locked)
10|3000 characters needed characters left

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:

  1. 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....

  1. HOW DO I DO THIS FROM MY 'APPLICATION'?? (I'd much prefer to do it in code)
more ▼

answered Jan 19 '10 at 08:09 AM

adam michaels gravatar image

adam michaels
693 21 26 30

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).

Jan 19 '10 at 09:26 AM jonas echterhoff ♦♦
(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Dec 02 '09 at 02:45 PM

Ashkan_gc gravatar image

Ashkan_gc
9.1k 33 56 117

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x984
x954
x812

asked: Dec 02 '09 at 02:17 PM

Seen: 4419 times

Last Updated: Dec 02 '09 at 02:24 PM