Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Unity3D WebGL Browser Player does not animate when using JavaScript external control

Discussion in 'Animation' started by ozkary, May 28, 2020.

  1. ozkary

    ozkary

    Joined:
    Nov 9, 2018
    Posts:
    6
    Unity (2018.1.9) to WebGL Target platform. When loaded on a web page, we interact with the WebGL scene by using the JavaScript bridge with the game instance (see below). We have a character associated with an animator and lipsync components.

    Code (JavaScript):
    1.  
    2. const gameInstance = UnityLoader.instantiate("gameContainer", "Build/Test.json");
    3. gameInstance.SendMessage("Control", "PlayAnimation","Hello");
    This should enable the character to play the requested animation, but there is no response. A call to pause the game works, so this is an indicator that the bridge has access to the internal calls.

    Code (JavaScript):
    1.   gameInstance.SendMessage("Control", "Pause");  //this works.
    Does anyone have a tip on what to look for? Thanks.