Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Setting custom webgl tags through script

Discussion in 'Web' started by PieterAlbers, Jan 25, 2017.

  1. PieterAlbers

    PieterAlbers

    Joined:
    Dec 2, 2014
    Posts:
    236
    Hi all!

    Is it possible to set a custom webgl tag through script? I can't find anything on it?
    I have a Version tag that I would like to set when making a new build.

    Is this possible at all?

    Cheers,
    Pieter
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Hi,
    What's a webgl tag?
     
  3. PieterAlbers

    PieterAlbers

    Joined:
    Dec 2, 2014
    Posts:
    236
    Hi!

    Sorry for being so unclear - I just reread my first post and I can understand any confusion.

    What I mean with webgl tag is a custom template tag which you can set and use in a webgl template (html)

    So atm I have a UNITY_CUSTOM_TAG_VERSION. This shows up as an editable textfield in the player settings inspector.

    I would like to set this dynamically (each time I make a new build).

    Is this possible?

    Thanks,
    Pieter
     
  4. Lost-in-the-Garden

    Lost-in-the-Garden

    Joined:
    Nov 18, 2015
    Posts:
    176
    I'd have the exact same question here. Any findings?
     
  5. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
  6. guitarjorge24

    guitarjorge24

    Joined:
    Oct 4, 2016
    Posts:
    12
  7. guitarjorge24

    guitarjorge24

    Joined:
    Oct 4, 2016
    Posts:
    12
    programlabgames likes this.
  8. programlabgames

    programlabgames

    Joined:
    Sep 5, 2018
    Posts:
    4
  9. programlabgames

    programlabgames

    Joined:
    Sep 5, 2018
    Posts:
    4
    I use parse index.html file and replace custom tags with my own values
     
  10. Xorboo

    Xorboo

    Joined:
    Dec 6, 2014
    Posts:
    6
    Sorry for necroposting, but I haven't found an answer to this in any of the threads, so decided to share the solution after some digging.

    To set it from script you should use
    PlayerSettings.SetTemplateCustomValue()
    method, which is for some reason not in the
    PlayerSettings.WebGL
    group (which is why it may be hard to find).

    1. Note that the docs now call it Custom user variables, they don't require
      UNITY_CUSTOM_
      prefix anymore, and are using
      {{{ triple brackets }}}
      instead of
      %percentage%
      wrappers
    2. They are also quite buggy to update, either not appearing in the settings or clearing up after input - restarting Unity and running a build fixed that for me
    3. Doing this on 2021.3