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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    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:
    129
    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.