Author Topic: Very first click not registering in Web Player  (Read 3622 times)

atamize

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Very first click not registering in Web Player
« on: February 06, 2014, 04:40:50 PM »
If you have a UI button in your scene when your game starts up in the Web Player, the very first time you try to click it, the click won't register. After clicking somewhere in the window at least once (not necessarily within the game window, but anywhere on the web page area), the clicks will start registering properly. Try this with any of the NGUI examples that have buttons.

Note that the mouse position is being tracked even before you click the first time as the hover events are clearly being registered.

This is not a case of the browser window not being "active" in the OS; the browser is definitely active when this occurs, but I suppose the web player doesn't consider it "active" unless you click on it at least once? If you refresh the web page after having "activated" clicks, you will still have to click again to reactivate once Unity loads the game.

Is this a limitation of the platform, or can something be done in software to correct it? Note that Unity's OnGUI() buttons do not suffer this problem.

I am experiencing this problem on Google Chrome and OSX. The issue does not occur in the Unity Editor or Standalone versions.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Very first click not registering in Web Player
« Reply #1 on: February 06, 2014, 08:47:10 PM »
That's how plugins work in Chrome as far as I know. You actually have to select the plugin's rect for it to become active and be capable of receiving input. OnGUI goes through a different set of events (OnGUI vs Update).