Search Unity

WebGL deep linking possible?

Discussion in 'General Discussion' started by Aseemy, Jun 5, 2022.

  1. Aseemy

    Aseemy

    Joined:
    Aug 22, 2015
    Posts:
    207
    A client wants this situation
    -User logs into Clients website
    -Purchases a ticket to play the game once
    -Clicks on a link that opens the WebGL game
    -game should recognize that the user has purchased a ticket and let him play once
    - the game should also recognize which ticket the user purchased and automatically start in that particular game mode
    -after the game is finished, the game should redirect the player back to the Clients website with the result of the game.

    Is this all possible? Kindly herd me in the right direction.

    What I am thinking is that somehow we create a unique user id (stored locally in user's system) from the clients website and store that info in a DB and store any tickets purchased there.
    When the WebGL game starts we locate the stored user id and check the DB for any tickets. Will the WebGL game be able to read the user id locally?
    Can this be done using user's IP address?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,005
    Yes, this is possible. When generating the link you can pass a session cookie via URL. You can read this from Unity, I believe it either works similar to command line parameters or worst case you'll have to add some javascript that passes the URL info to Unity. Haven't done it personally so I can't comment on how to do it technically but it has been done to launch game in a specific mode (ie develop mode).

    Not sure about redirecting back. I would simply launch the game in the same tab as overlay or embedded frame.

    To access databases you can issue HTTP Rest calls from within Unity.
     
    Aseemy likes this.