Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Passing in variables to project?

Discussion in 'Project Tiny' started by Exsert, May 5, 2019.

  1. Exsert

    Exsert

    Joined:
    Oct 22, 2015
    Posts:
    42
    Hello all,
    I am working on some online little game that I want to put embedded into my website.

    Upon login I want you to be able to play the game. So I would like to be able to send the game the auth token I have from being logged into the site, this would allow me to authorise any websocket calls. But unfortunately I don't know how to pass through variables into the game.

    Has any one had experience with this yet?


    Appreciate any input!
     
  2. Rupture13

    Rupture13

    Joined:
    Apr 12, 2016
    Posts:
    131
    Not sure if it would be the cleanest approach, but you could store data in HTML elements in your page, search them from Tiny context and then read the InnerHTML data.
     
    Exsert likes this.
  3. Exsert

    Exsert

    Joined:
    Oct 22, 2015
    Posts:
    42
    Hmm, If it's stored in local storage, do you reckon I could access that using tiny?
     
  4. Exsert

    Exsert

    Joined:
    Oct 22, 2015
    Posts:
    42
    localStorage works! This is going to be very useful!
     
  5. Dnine

    Dnine

    Joined:
    Oct 10, 2013
    Posts:
    6
    Hello, can you share an example script? How to store data in HTML elements and how to get the data from tiny project.