Search Unity

Website and HTML5 Game Interaction.

Discussion in 'Scripting' started by BatmanDeveloper, Jul 19, 2017.

  1. BatmanDeveloper

    BatmanDeveloper

    Joined:
    Jul 1, 2017
    Posts:
    54
    Hi.

    I have a javascript in my webpage and I have a function called ( HelloUnity ). How could I call that function from my webpage and show the string message into my html5 game ? What is the best way ?

    myPage.js

    Code (CSharp):
    1.  
    2.       function HelloUnity()
    3.       {
    4.         var text = "HELLO";
    5.       }
    6.  
    Thank You
     
  2. sonofbryce

    sonofbryce

    Joined:
    May 19, 2009
    Posts:
    111
  3. BatmanDeveloper

    BatmanDeveloper

    Joined:
    Jul 1, 2017
    Posts:
    54
  4. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    What does your code look like? The error says "gameInstance.sendMessage is not a function". The method is "SendMessage" not "sendMessage". Is that the problem?
     
    sonofbryce likes this.
  5. BatmanDeveloper

    BatmanDeveloper

    Joined:
    Jul 1, 2017
    Posts:
    54
    Thank You
     
    LiterallyJeff likes this.