Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity Web Player: Cannot click in div with webkit-transform

Discussion in 'Editor & General Support' started by jollibee, Jun 13, 2014.

  1. jollibee

    jollibee

    Joined:
    Sep 7, 2010
    Posts:
    4
    1. build a web player scene with button click event.
    2. modify
    Code (JavaScript):
    1. <div class="content">
    to
    Code (JavaScript):
    1. <div class="content" style="-webkit-transform: scale(0.5, 0.5)">
    The button in the scene will no longer clickable. I guess the position of the button changed when zoom the div in HTML. But I have not a solution for this problem.
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Not heard people talk about this before, but yes, I think scaling the div in the DOM is probably confusing the web player. Can you not change the dimensions of the div oldskool? Also, if Unity doesn't know the div has changed, maybe call into the game and tell Unity things have changed.
     
  3. jollibee

    jollibee

    Joined:
    Sep 7, 2010
    Posts:
    4
    The web player in part of a big html5 page. and its ancestors div zoom with css3.

    I tried reload the web player after div transform, but the problem still exist.
     
  4. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Well, Unity is probably getting the width and height for the div from the DOM. If you compute the actual size and send that over to the web player does that help at all?
     
  5. jollibee

    jollibee

    Joined:
    Sep 7, 2010
    Posts:
    4
    It works, thank you very much.

    1. add transform on unityPlayer Div to zoom back, css similar with: width:402px;height:300px;-webkit-transform: scale(2, 2);-webkit-transform-origin:0% 0%;

    2. set actual size to embed element: width:402px;height:300px;

    The original width of unityPlayer is 804px.
     
    Graham-Dunnett likes this.