Search Unity

Question loop in webgl template preprocessor directives?

Discussion in 'Web' started by Marks4, Dec 1, 2022.

  1. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    536
    I was taking a look at Tamplate variables, macros, and conditional directives, and was wondering if it's possible to achieve a loop like explained here. I have a custom user variable that is a number and would like to make a for loop with it.

    For example, instead of

    #if MYVAR === 0
    //bla
    #endif

    #if MYVAR === 1
    //bla
    #endif

    I would like to do something equivalent of

    #for i = 0; i < MYVAR; ++i
    //bla
    #endfor
     
  2. TomTheMan59

    TomTheMan59

    Joined:
    Mar 8, 2021
    Posts:
    356

    Sorry to bother you, but I was just wondering how do you use MYVar?

    I set
    PlayerSettings.SetTemplateCustomValue("BETA_BUILD", "test"); and
    #if {{{BETA_BUILD }}} in the html, but this throws an error?

    thanks sir