Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Arlocke · Feb 16, 2017 at 03:34 AM · buildmousewebglmouseclickmousedrag

Input.GetMouseButtonDown not working on WebGL build

I have a project for a client which specifies for a WebGL build to be supplied, but the game breaks as the build does not seem to support the detection of any mouse presses using the Input class, although it does recognise mouse clicks on UI Canvas elements.

I have tried unchecking the 'strip engine code' option in the player settings but that has made no difference.

I am at a loss to know how to debug WebGL but I'm interested to know if anybody could suggest a solution or workaround. I am on Unity 5.5.1p3 on Mac. Thank you.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Oana · Feb 16, 2017 at 07:57 AM 0
Share

It should work fine, without needing to do anything special.

The steps I'd take to debug this are:

  • Does it work in the Editor?

  • Is it in Update or some other method?

  • Put a Debug.Log to see if it doesn't trigger at all or if it's just what I'm trying to do that doesn't work (There are some weird instances of this)

  • If all else fails, and UI canvas works, I'd add a UI element on the whole screen that acts as a makeshift input system.

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Arlocke · Feb 16, 2017 at 10:26 AM

I figured out what the issue was. I was using Input.touchSupported to check whether I should be attempting to use touch or mouse input, and this always returns true on any WebGL build, presumably because the build can't tell what actual hardware is attached, even though I was on a laptop with a mouse.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image instruct9r · Feb 16, 2017 at 11:05 AM 0
Share

Don't post answers as comments! Post comment ins$$anonymous$$d...

avatar image
0

Answer by imrankhanswati · Feb 16, 2017 at 10:23 AM

you can use Input.GetKeyDown(KeyCode.mouse0); instead.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HECer · Jan 11, 2020 at 10:53 PM 0
Share

Sadly it also doesn't work for me

avatar image HECer · Jan 11, 2020 at 10:53 PM 0
Share

Sadly it also doesn't work for me

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

74 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Sharing violation on WebGL Build with GZip 1 Answer

How to use Webgl Debug Symbols? 0 Answers

Webgl not loading 1 Answer

Host on the web a game without WebGL, is it possible? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges